I've prepared my own commit message template and commit-msg hook for validation purposes. This hook is a simple Python script. It works but I'd like to have also Change-id at the bottom of my commit message. I see that from gerrit I can download commit-msg hook which is written in Bash and this hook provides solution for Change-id generation: https://gerrit-review.googlesource.com/Documentation/user-changeid.html. But now I have 2 different commit-msg hooks. So should I rewrite my own msg-hook and append it to that official msg-hook template or maybe I should write my own implementation of Change-id generator?
modify the MSG
variable definition at the beginning of the original commit-msg hook by replacing $1
input param with your script output
#!/bin/sh
# From Gerrit Code Review 2.14.20-179-g6c46f4efba
#
# Part of Gerrit Code Review (https://www.gerritcodereview.com/)
#
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
unset GREP_OPTIONS
CHANGE_ID_AFTER="Bug|Depends-On|Issue|Test|Feature|Fixes|Fixed"
MSG=`python /path/to/myscript.py`
# Check for, and add if missing, a unique Change-Id
#
add_ChangeId() {
clean_message=`sed -e '