Class: Overcommit::HookContext::PostCheckout

Inherits:
Base
  • Object
show all
Defined in:
lib/overcommit/hook_context/post_checkout.rb

Instance Method Summary collapse

Methods inherited from Base

#cleanup_environment, #hook_class_name, #hook_script_name, #hook_type_name, #initialize, #modified_files, #modified_lines, #setup_environment

Constructor Details

This class inherits a constructor from Overcommit::HookContext::Base

Instance Method Details

#branch_checkout?Boolean

Returns whether this checkout was the result of changing/updating a branch.

Returns:



15
16
17
# File 'lib/overcommit/hook_context/post_checkout.rb', line 15

def branch_checkout?
  @args[2].to_i == 1
end

#file_checkout?Boolean

Returns whether this checkout was for a single file.

Returns:



20
21
22
# File 'lib/overcommit/hook_context/post_checkout.rb', line 20

def file_checkout?
  !branch_checkout?
end

#new_headObject

Returns the ref of the new current HEAD.



9
10
11
# File 'lib/overcommit/hook_context/post_checkout.rb', line 9

def new_head
  @args[1]
end

#previous_headObject

Returns the ref of the HEAD that we transitioned from.



4
5
6
# File 'lib/overcommit/hook_context/post_checkout.rb', line 4

def previous_head
  @args[0]
end