Class: Overcommit::HookContext::PostCommit

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

Overview

Contains helpers related to contextual information used by post-commit hooks.

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

#modified_files_last_commitObject

Get a list of added, copied, or modified files that have been staged. Renames and deletions are ignored, since there should be nothing to check.



7
8
9
# File 'lib/overcommit/hook_context/post_commit.rb', line 7

def modified_files_last_commit
  @modified_files_last_commit ||= Overcommit::GitRepo.modified_files_last_commit
end

#modified_lines_in_file_last_commit(file) ⇒ Object

Returns the set of line numbers corresponding to the lines that were changed in a specified file.



13
14
15
16
17
# File 'lib/overcommit/hook_context/post_commit.rb', line 13

def modified_lines_in_file_last_commit(file)
  @modified_lines_last_commit ||= {}
  @modified_lines_last_commit[file] ||=
    Overcommit::GitRepo.extract_modified_lines_last_commit(file)
end