class Overcommit::HookContext::Diff
Simulates a pre-commit context based on the diff with another git ref.
This results in pre-commit hooks running against the changes between the current and another ref, which is useful for automated CI scripts.
Public Instance Methods
Source
# File lib/overcommit/hook_context/diff.rb, line 23 def hook_class_name 'PreCommit' end
Source
# File lib/overcommit/hook_context/diff.rb, line 31 def hook_script_name 'pre-commit' end
Source
# File lib/overcommit/hook_context/diff.rb, line 27 def hook_type_name 'pre_commit' end
Source
# File lib/overcommit/hook_context/diff.rb, line 35 def initial_commit? @initial_commit ||= Overcommit::GitRepo.initial_commit? end
Source
# File lib/overcommit/hook_context/diff.rb, line 13 def modified_files @modified_files ||= Overcommit::GitRepo.modified_files(refs: @options[:diff]) end
Source
# File lib/overcommit/hook_context/diff.rb, line 17 def modified_lines_in_file(file) @modified_lines ||= {} @modified_lines[file] ||= Overcommit::GitRepo.extract_modified_lines(file, refs: @options[:diff]) end