Sha256: cec1197b0d72d1f6cf78fb6d19b3755b275b1a3c21e6a791d0d85734e6cfa36b

Contents?: true

Size: 724 Bytes

Versions: 2

Compression:

Stored size: 724 Bytes

Contents

module Overcommit::Hook::CommitMsg
  # 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.
  #
  # @see https://code.google.com/p/gerrit/
  class GerritChangeId < Base
    SCRIPT_LOCATION = Overcommit::Utils.script_path('gerrit-change-id')

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

      [:fail, result.stdout]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
overcommit-0.27.0 lib/overcommit/hook/commit_msg/gerrit_change_id.rb
overcommit-0.26.0 lib/overcommit/hook/commit_msg/gerrit_change_id.rb