Update the commit-msg hook to the version from Gerrit 2.8.2

Change-Id: Id911bc6841f488a42d08580de800c3afafa2937e
This commit is contained in:
Dave Borowitz 2014-07-15 11:30:06 -07:00
parent a6d258b84d
commit a8d539189e

View File

@ -1,5 +1,4 @@
#!/bin/sh
# From Gerrit Code Review 2.6
#
# Part of Gerrit Code Review (http://code.google.com/p/gerrit/)
#
@ -27,7 +26,7 @@ MSG="$1"
#
add_ChangeId() {
clean_message=`sed -e '
/^diff --git a\/.*/{
/^diff --git .*/{
s///
q
}
@ -39,6 +38,11 @@ add_ChangeId() {
return
fi
if test "false" = "`git config --bool --get gerrit.createChangeId`"
then
return
fi
# Does Change-Id: already exist? if so, exit (no change).
if grep -i '^Change-Id:' "$MSG" >/dev/null
then
@ -77,7 +81,7 @@ add_ChangeId() {
# Skip the line starting with the diff command and everything after it,
# up to the end of the file, assuming it is only patch data.
# If more than one line before the diff was empty, strip all but one.
/^diff --git a/ {
/^diff --git / {
blankLines = 0
while (getline) { }
next