Class: Overcommit::Hook::CommitMsg::GerritChangeId

Inherits:
Base
  • Object
show all
Defined in:
lib/overcommit/hook/commit_msg/gerrit_change_id.rb

Overview

Ensures a Gerrit Change-Id line is included in the commit message.

It may seem odd to do this here instead of in a prepare-commit-msg hook, but the reality is that if you want to ensure the Change-Id is included then you need to do it in a commit-msg hook. This is because the user could still edit the message after a prepare-commit-msg hook was run.

Constant Summary collapse

SCRIPT_LOCATION =
Overcommit::Utils.script_path('gerrit-change-id')

Instance Method Summary collapse

Methods inherited from Base

#applicable_files, #description, #enabled?, #execute, #in_path?, #initialize, #name, #quiet?, #required?, #run?, #skip?

Constructor Details

This class inherits a constructor from Overcommit::Hook::Base

Instance Method Details

#runObject



11
12
13
14
15
16
# File 'lib/overcommit/hook/commit_msg/gerrit_change_id.rb', line 11

def run
  result = execute([SCRIPT_LOCATION, commit_message_file])
  return :good if result.success?

  [:bad, result.stdout]
end