Sha256: 930bdcdfabfde9a779bc968568085dd7b263c01b2aadc4b6c7354b6ba9fedf8a
Contents?: true
Size: 1.09 KB
Versions: 33
Compression:
Stored size: 1.09 KB
Contents
module Overcommit::HookContext # Contains helpers related to contextual information used by post-merge # hooks. class PostMerge < Base attr_accessor :args # 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. def modified_files staged = squash? refs = 'HEAD^ HEAD' if merge_commit? @modified_files ||= Overcommit::GitRepo.modified_files(staged: staged, refs: refs) end # Returns the set of line numbers corresponding to the lines that were # changed in a specified file. 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 # Returns whether this merge was made using --squash def squash? @args[0].to_i == 1 end # Returns whether this merge was made without --squash def merge_commit? !squash? end end end
Version data entries
33 entries across 31 versions & 2 rubygems