Class: Gitlab::GitPostReceive
- Inherits:
-
Object
- Object
- Gitlab::GitPostReceive
- Includes:
- Identifier
- Defined in:
- lib/gitlab/git_post_receive.rb
Instance Attribute Summary collapse
-
#changes ⇒ Object
readonly
Returns the value of attribute changes.
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#push_options ⇒ Object
readonly
Returns the value of attribute push_options.
Instance Method Summary collapse
- #identify ⇒ Object
- #includes_branches? ⇒ Boolean
- #includes_default_branch? ⇒ Boolean
- #includes_tags? ⇒ Boolean
-
#initialize(container, identifier, changes, push_options = {}) ⇒ GitPostReceive
constructor
A new instance of GitPostReceive.
Methods included from Identifier
#identification_cache, #identify_using_deploy_key, #identify_using_ssh_key, #identify_using_user, #identify_with_cache
Constructor Details
#initialize(container, identifier, changes, push_options = {}) ⇒ GitPostReceive
Returns a new instance of GitPostReceive.
9 10 11 12 13 14 |
# File 'lib/gitlab/git_post_receive.rb', line 9 def initialize(container, identifier, changes, = {}) @container = container @identifier = identifier @changes = parse_changes(changes) @push_options = end |
Instance Attribute Details
#changes ⇒ Object (readonly)
Returns the value of attribute changes.
7 8 9 |
# File 'lib/gitlab/git_post_receive.rb', line 7 def changes @changes end |
#container ⇒ Object (readonly)
Returns the value of attribute container.
7 8 9 |
# File 'lib/gitlab/git_post_receive.rb', line 7 def container @container end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
7 8 9 |
# File 'lib/gitlab/git_post_receive.rb', line 7 def identifier @identifier end |
#push_options ⇒ Object (readonly)
Returns the value of attribute push_options.
7 8 9 |
# File 'lib/gitlab/git_post_receive.rb', line 7 def @push_options end |
Instance Method Details
#identify ⇒ Object
16 17 18 |
# File 'lib/gitlab/git_post_receive.rb', line 16 def identify super(identifier) || identify_using_deploy_key(identifier)&.user end |
#includes_branches? ⇒ Boolean
20 21 22 |
# File 'lib/gitlab/git_post_receive.rb', line 20 def includes_branches? changes.includes_branches? end |
#includes_default_branch? ⇒ Boolean
28 29 30 31 32 33 34 35 36 |
# File 'lib/gitlab/git_post_receive.rb', line 28 def includes_default_branch? # If the branch doesn't have a default branch yet, we presume the # first branch pushed will be the default. return true unless container.default_branch.present? changes.branch_changes.any? do |change| Gitlab::Git.branch_name(change[:ref]) == container.default_branch end end |
#includes_tags? ⇒ Boolean
24 25 26 |
# File 'lib/gitlab/git_post_receive.rb', line 24 def changes. end |