summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-01-11 18:01:50 -0500
committerBrad King <brad.king@kitware.com>2011-01-11 18:01:50 -0500
commitb22ff892df4bbb55d9ef23f99d2e4b144d0ba607 (patch)
treedba2b7e103bc20024d5ea8027f12347c78e4e754
parent6d1fe685cb08cba7f1b32e721cb474025bad2e03 (diff)
downloadcmake-b22ff892df4bbb55d9ef23f99d2e4b144d0ba607.tar.gz
commit-msg: Do not advise use of COMMIT_MSG after removal
Once our temporary COMMIT_MSG file has been removed do not advise the author to use the file to continue editing the message.
-rwxr-xr-xcommit-msg11
1 files changed, 7 insertions, 4 deletions
diff --git a/commit-msg b/commit-msg
index c4d8f06d30..b9c528b2eb 100755
--- a/commit-msg
+++ b/commit-msg
@@ -21,15 +21,17 @@
commit_msg="$GIT_DIR/COMMIT_MSG"
sed -n -e '/^#/d' -e '/^diff --git/q' -e 'p;d' "$1" > "$commit_msg"
+die_advice='
+To continue editing, run the command
+ git commit -e -F '"$commit_msg"'
+(assuming your working directory is at the top).'
+
die() {
echo 'commit-msg hook failure' 1>&2
echo '-----------------------' 1>&2
echo '' 1>&2
echo "$@" 1>&2
- echo '
-To continue editing, run the command
- git commit -e -F '"$commit_msg"'
-(assuming your working directory is at the top).' 1>&2
+ test -n "$die_advice" && echo "$die_advice" 1>&2
exit 1
}
@@ -97,6 +99,7 @@ while IFS='' read line; do
msg_$state || break
done &&
rm -f "$commit_msg" || exit 1
+die_advice='' # No more temporary message file.
#-----------------------------------------------------------------------------
# Optionally run Gerrit's commit-msg hook to add a Change-Id line.