class Overcommit::HookContext::PostCheckout
Contains helpers related to contextual information used by post-checkout hooks.
Public Instance Methods
branch_checkout?()
click to toggle source
Returns whether this checkout was the result of changing/updating a branch.
# File lib/overcommit/hook_context/post_checkout.rb, line 19 def branch_checkout? @args[2].to_i == 1 end
file_checkout?()
click to toggle source
Returns whether this checkout was for a single file.
# File lib/overcommit/hook_context/post_checkout.rb, line 24 def file_checkout? !branch_checkout? end
modified_files()
click to toggle source
Get a list of files that have been added or modified between ‘previous_head` and `new_head`. Renames and deletions are ignored, since there should be nothing to check.
# File lib/overcommit/hook_context/post_checkout.rb, line 31 def modified_files @modified_files ||= Overcommit::GitRepo.modified_files(refs: "#{previous_head} #{new_head}") end
new_head()
click to toggle source
Returns the ref of the new current HEAD.
# File lib/overcommit/hook_context/post_checkout.rb, line 13 def new_head @args[1] end
previous_head()
click to toggle source
Returns the ref of the HEAD that we transitioned from.
# File lib/overcommit/hook_context/post_checkout.rb, line 8 def previous_head @args[0] end