[PATCH] git-commit: Disallow amend if it is going to produce an empty non-merge commit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Looks like initial commit v1.2.4-370-g8588452 was wrong
from the time being, because amend support was already
implemented in run_status() by commit v1.2.4-211-gb4019f0.

 git-commit.sh |    2 +-
 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
-- 
ldv
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux