Class: Overcommit::HookContext::PrePush::PushedRef
- Inherits:
-
Struct
- Object
- Struct
- Overcommit::HookContext::PrePush::PushedRef
- Defined in:
- lib/overcommit/hook_context/pre_push.rb
Instance Attribute Summary collapse
-
#local_ref ⇒ Object
Returns the value of attribute local_ref.
-
#local_sha1 ⇒ Object
Returns the value of attribute local_sha1.
-
#remote_ref ⇒ Object
Returns the value of attribute remote_ref.
-
#remote_sha1 ⇒ Object
Returns the value of attribute remote_sha1.
Instance Method Summary collapse
- #created? ⇒ Boolean
- #deleted? ⇒ Boolean
- #destructive? ⇒ Boolean
- #forced? ⇒ Boolean
- #modified_files ⇒ Object
- #modified_lines_in_file(file) ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#local_ref ⇒ Object
Returns the value of attribute local_ref
42 43 44 |
# File 'lib/overcommit/hook_context/pre_push.rb', line 42 def local_ref @local_ref end |
#local_sha1 ⇒ Object
Returns the value of attribute local_sha1
42 43 44 |
# File 'lib/overcommit/hook_context/pre_push.rb', line 42 def local_sha1 @local_sha1 end |
#remote_ref ⇒ Object
Returns the value of attribute remote_ref
42 43 44 |
# File 'lib/overcommit/hook_context/pre_push.rb', line 42 def remote_ref @remote_ref end |
#remote_sha1 ⇒ Object
Returns the value of attribute remote_sha1
42 43 44 |
# File 'lib/overcommit/hook_context/pre_push.rb', line 42 def remote_sha1 @remote_sha1 end |
Instance Method Details
#created? ⇒ Boolean
47 48 49 |
# File 'lib/overcommit/hook_context/pre_push.rb', line 47 def created? remote_sha1 == '0' * 40 end |
#deleted? ⇒ Boolean
51 52 53 |
# File 'lib/overcommit/hook_context/pre_push.rb', line 51 def deleted? local_sha1 == '0' * 40 end |
#destructive? ⇒ Boolean
55 56 57 |
# File 'lib/overcommit/hook_context/pre_push.rb', line 55 def destructive? deleted? || forced? end |
#forced? ⇒ Boolean
43 44 45 |
# File 'lib/overcommit/hook_context/pre_push.rb', line 43 def forced? !(created? || deleted? || overwritten_commits.empty?) end |
#modified_files ⇒ Object
59 60 61 |
# File 'lib/overcommit/hook_context/pre_push.rb', line 59 def modified_files Overcommit::GitRepo.modified_files(refs: ref_range) end |
#modified_lines_in_file(file) ⇒ Object
63 64 65 |
# File 'lib/overcommit/hook_context/pre_push.rb', line 63 def modified_lines_in_file(file) Overcommit::GitRepo.extract_modified_lines(file, refs: ref_range) end |
#to_s ⇒ Object
67 68 69 |
# File 'lib/overcommit/hook_context/pre_push.rb', line 67 def to_s "#{local_ref} #{local_sha1} #{remote_ref} #{remote_sha1}" end |