summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Borowitz <dborowitz@google.com>2014-07-15 11:30:06 -0700
committerDave Borowitz <dborowitz@google.com>2014-07-15 11:30:06 -0700
commita8d539189e1c788663f022cbebd3b5ff28aaeb4b (patch)
treed2be60df39b9026dfb1f8733ccbb7df2b01ff5f3
parenta6d258b84d0d2fc0f995e6160ab4ccc7cb4c8396 (diff)
downloadgit-repo-a8d539189e1c788663f022cbebd3b5ff28aaeb4b.tar.gz
Update the commit-msg hook to the version from Gerrit 2.8.2
Change-Id: Id911bc6841f488a42d08580de800c3afafa2937e
-rwxr-xr-xhooks/commit-msg10
1 files changed, 7 insertions, 3 deletions
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 @@
1#!/bin/sh 1#!/bin/sh
2# From Gerrit Code Review 2.6
3# 2#
4# Part of Gerrit Code Review (http://code.google.com/p/gerrit/) 3# Part of Gerrit Code Review (http://code.google.com/p/gerrit/)
5# 4#
@@ -27,7 +26,7 @@ MSG="$1"
27# 26#
28add_ChangeId() { 27add_ChangeId() {
29 clean_message=`sed -e ' 28 clean_message=`sed -e '
30 /^diff --git a\/.*/{ 29 /^diff --git .*/{
31 s/// 30 s///
32 q 31 q
33 } 32 }
@@ -39,6 +38,11 @@ add_ChangeId() {
39 return 38 return
40 fi 39 fi
41 40
41 if test "false" = "`git config --bool --get gerrit.createChangeId`"
42 then
43 return
44 fi
45
42 # Does Change-Id: already exist? if so, exit (no change). 46 # Does Change-Id: already exist? if so, exit (no change).
43 if grep -i '^Change-Id:' "$MSG" >/dev/null 47 if grep -i '^Change-Id:' "$MSG" >/dev/null
44 then 48 then
@@ -77,7 +81,7 @@ add_ChangeId() {
77 # Skip the line starting with the diff command and everything after it, 81 # Skip the line starting with the diff command and everything after it,
78 # up to the end of the file, assuming it is only patch data. 82 # up to the end of the file, assuming it is only patch data.
79 # If more than one line before the diff was empty, strip all but one. 83 # If more than one line before the diff was empty, strip all but one.
80 /^diff --git a/ { 84 /^diff --git / {
81 blankLines = 0 85 blankLines = 0
82 while (getline) { } 86 while (getline) { }
83 next 87 next