class Overcommit::HookContext::PostMerge
Contains helpers related to contextual information used by post-merge hooks.
Attributes
args[RW]
Public Instance Methods
merge_commit?()
click to toggle source
Returns whether this merge was made without –squash
# File lib/overcommit/hook_context/post_merge.rb, line 33 def merge_commit? !squash? end
modified_files()
click to toggle source
Get a list of files that were added, copied, or modified in the merge commit. Renames and deletions are ignored, since there should be nothing to check.
# File lib/overcommit/hook_context/post_merge.rb, line 11 def modified_files staged = squash? refs = 'HEAD^ HEAD' if merge_commit? @modified_files ||= Overcommit::GitRepo.modified_files(staged: staged, refs: refs) end
modified_lines_in_file(file)
click to toggle source
Returns the set of line numbers corresponding to the lines that were changed in a specified file.
# File lib/overcommit/hook_context/post_merge.rb, line 19 def modified_lines_in_file(file) staged = squash? refs = 'HEAD^ HEAD' if merge_commit? @modified_lines ||= {} @modified_lines[file] ||= Overcommit::GitRepo.extract_modified_lines(file, staged: staged, refs: refs) end
squash?()
click to toggle source
Returns whether this merge was made using –squash
# File lib/overcommit/hook_context/post_merge.rb, line 28 def squash? @args[0].to_i == 1 end