summaryrefslogtreecommitdiff
path: root/git-commit.sh
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2007-09-12 16:14:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-09-12 17:50:27 (GMT)
commit4fb5fd5d301ee53882a3c2ed717c5a9fd6dc0506 (patch)
treed6e5ce7549155b3d7a2dca968afcfcd6f5895057 /git-commit.sh
parent3803bceae84fe122eccb49e3096abead508cde8f (diff)
downloadgit-4fb5fd5d301ee53882a3c2ed717c5a9fd6dc0506.zip
git-4fb5fd5d301ee53882a3c2ed717c5a9fd6dc0506.tar.gz
git-4fb5fd5d301ee53882a3c2ed717c5a9fd6dc0506.tar.bz2
git-commit: Disallow amend if it is going to produce an empty non-merge commit
Right now one can amend the last non-merge commit using a dirty index and in the process maybe cause the last commit to have the same tree as its parent. In such a case one would want to discard the last commit instead of amending it. This reverts commit 8588452ceb78b1da17652ba03f9942ef740e07ea. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-commit.sh')
-rwxr-xr-xgit-commit.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/git-commit.sh b/git-commit.sh
index 1d04f1f..41538f1 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -554,7 +554,7 @@ else
# we need to check if there is anything to commit
run_status >/dev/null
fi
-if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" -a -z "$amend" ]
+if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" ]
then
rm -f "$GIT_DIR/COMMIT_EDITMSG" "$GIT_DIR/SQUASH_MSG"
use_status_color=t