Class: Overcommit::HookContext::CommitMsg
- Defined in:
- lib/overcommit/hook_context/commit_msg.rb
Overview
Contains helpers related to contextual information used by commit-msg hooks.
Instance Method Summary collapse
-
#commit_message ⇒ Object
User commit message stripped of comments and diff (from verbose output).
- #commit_message_file ⇒ Object
- #commit_message_lines ⇒ Object
-
#update_commit_message(message) ⇒ Object
Updates the commit message to the specified text.
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
#commit_message ⇒ Object
User commit message stripped of comments and diff (from verbose output).
5 6 7 |
# File 'lib/overcommit/hook_context/commit_msg.rb', line 5 def .join end |
#commit_message_file ⇒ Object
22 23 24 |
# File 'lib/overcommit/hook_context/commit_msg.rb', line 22 def @args[0] end |
#commit_message_lines ⇒ Object
16 17 18 19 20 |
# File 'lib/overcommit/hook_context/commit_msg.rb', line 16 def . reject { |line| line =~ /^#/ }. take_while { |line| !line.start_with?('diff --git') } end |
#update_commit_message(message) ⇒ Object
Updates the commit message to the specified text.
10 11 12 13 14 |
# File 'lib/overcommit/hook_context/commit_msg.rb', line 10 def () ::File.open(, 'w') do |file| file.write() end end |