From 4fb5fd5d301ee53882a3c2ed717c5a9fd6dc0506 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Wed, 12 Sep 2007 20:14:22 +0400 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- git-commit.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-commit.sh b/git-commit.sh index 1d04f1ff31..41538f16e5 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 -- 2.11.4.GIT