1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-10 05:16:15 +02:00

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 8588452ceb.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Dmitry V. Levin 2007-09-12 20:14:22 +04:00 committed by Junio C Hamano
parent 3803bceae8
commit 4fb5fd5d30

View File

@ -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