summaryrefslogtreecommitdiffstats
path: root/git-hooks
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2012-05-03 03:17:35 -0500
committerNorbert Thiebaud <nthiebaud@gmail.com>2012-05-03 03:28:53 -0500
commit298fbdc42af781cdd47d2cbedd945ec8c4a564bc (patch)
treebb745c26482aefdc93a4043a6d3dfeef0fe02577 /git-hooks
parentfix sc_chart_regression_test build with system-libxml2 (diff)
downloadcore-298fbdc42af781cdd47d2cbedd945ec8c4a564bc.tar.gz
core-298fbdc42af781cdd47d2cbedd945ec8c4a564bc.zip
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>
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;