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.
-
#gitaly_context ⇒ Object
readonly
Returns the value of attribute gitaly_context.
-
#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 = {}, gitaly_context = {}) ⇒ 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 = {}, gitaly_context = {}) ⇒ GitPostReceive
Returns a new instance of GitPostReceive.
9 10 11 12 13 14 15 |
# File 'lib/gitlab/git_post_receive.rb', line 9 def initialize(container, identifier, changes, = {}, gitaly_context = {}) @container = container @identifier = identifier @changes = parse_changes(changes) @push_options = @gitaly_context = gitaly_context 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 |
#gitaly_context ⇒ Object (readonly)
Returns the value of attribute gitaly_context.
7 8 9 |
# File 'lib/gitlab/git_post_receive.rb', line 7 def gitaly_context @gitaly_context 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
17 18 19 |
# File 'lib/gitlab/git_post_receive.rb', line 17 def identify super(identifier) || identify_using_deploy_key(identifier)&.user end |
#includes_branches? ⇒ Boolean
21 22 23 |
# File 'lib/gitlab/git_post_receive.rb', line 21 def includes_branches? changes.includes_branches? end |
#includes_default_branch? ⇒ Boolean
29 30 31 32 33 34 35 36 37 |
# File 'lib/gitlab/git_post_receive.rb', line 29 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
25 26 27 |
# File 'lib/gitlab/git_post_receive.rb', line 25 def changes. end |