Skip to content

Commit

Permalink
git-commit: Disallow amend if it is going to produce an empty non-mer…
Browse files Browse the repository at this point in the history
…ge 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 8588452.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Dmitry V. Levin authored and Junio C Hamano committed Sep 12, 2007
1 parent 3803bce commit 4fb5fd5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion git-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4fb5fd5

Please sign in to comment.