commit-msg: Do not add Change-Id to temp commits

Temporary commits that are created using "git commit --fixup"
or "git commit --squash" are not supposed to be pushed to gerrit.

Prevent pushing them by mistake, at least for project that
require Change-Id.

Change-Id: I9ac25b7384a128fea376a357f2b324b286622e2c
This commit is contained in:
Orgad Shaneh
2015-11-10 13:43:14 +02:00
parent a3a53d446f
commit 0a63010e56

View File

@@ -38,6 +38,12 @@ add_ChangeId() {
return
fi
# Do not add Change-Id to temp commits
if echo "$clean_message" | head -1 | grep -q '^\(fixup\|squash\)!'
then
return
fi
if test "false" = "`git config --bool --get gerrit.createChangeId`"
then
return