diff --git a/hooks/commit-msg b/hooks/commit-msg index 5ca2b112..d8f009b6 100755 --- a/hooks/commit-msg +++ b/hooks/commit-msg @@ -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