summaryrefslogtreecommitdiff
path: root/git-hooks
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2012-05-03 03:17:35 -0500
committerPetr Mladek <pmladek@suse.cz>2012-05-15 13:21:29 +0200
commitdbae2cbc29f960916469f33a9dd153157a42c64a (patch)
treee0ec91079a940e14c4037588e55c5187491f816a /git-hooks
parente9f8b89ea8781f115c8782296d61f833fc1c8f7b (diff)
commit-hook: tweak add_ChangeId() to tolerate git-am -s behavior
git-am -s add systematically an empty line before adding the signoff line, which interfere with gerrit's rule that the ChangeID must be in the last paragraph This patch address that be remoming an existing Change-Id from the commit message and re-insterting it at the 'proper' place Change-Id: I I742b17031c6e3da4f9d94dcb0579bce8c496d41d Signed-off-by: Norbert Thiebaud <nthiebaud@gmail.com> Signed-off-by: Petr Mladek <pmladek@suse.cz>
Diffstat (limited to 'git-hooks')
-rwxr-xr-xgit-hooks/commit-msg10
1 files changed, 6 insertions, 4 deletions
diff --git a/git-hooks/commit-msg b/git-hooks/commit-msg
index f8df4e2075f4..d784d6561130 100755
--- a/git-hooks/commit-msg
+++ b/git-hooks/commit-msg
@@ -100,12 +100,14 @@ add_ChangeId() {
return
fi
- if grep -i '^Change-Id:' "$MSG" >/dev/null
+ id=`grep -i '^Change-Id:' "$MSG" | sed -e "s/.*://"`
+ temp_msg=`grep -v -i '^Change-Id:' "$MSG"`
+ echo "$temp_msg" > "$MSG"
+
+ if test -z "$id"
then
- return
+ id=`_gen_ChangeId`
fi
-
- id=`_gen_ChangeId`
perl -e '
$MSG = shift;
$id = shift;