git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-am: make --abort less dangerous

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 26, 2009, 19:24 UTC
Message-ID
<7v8wntrogi.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1235641973-18307-1-git-send-email-git@drmicha.warpmail.net>

When you are in the middle of "git rebase", "git am --abort" by mistake would have referred to nonexistent ORIG_HEAD and barfed, or worse yet, used a stale ORIG_HEAD and taken you to an unexpected commit.

Also the option parsing did not reject "git am --abort --skip".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * An independent fix but textually depends on your patch.
 git-am.sh |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index 351b4f8..d339075 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -221,6 +221,9 @@ then
 	resume=yes
 
 	case "$skip,$abort" in
+	t,t)
+		die "Please make up your mind. --skip or --abort?"
+		;;
 	t,)
 		git rerere clear
 		git read-tree --reset -u HEAD HEAD
@@ -229,6 +232,10 @@ then
 		git update-ref ORIG_HEAD $orig_head
 		;;
 	,t)
+		if test -f "$dotest/rebasing"
+		then
+			exec git rebase --abort
+		fi
 		git rerere clear
 		test -f "$dotest/dirtyindex" || {
 			git read-tree --reset -u HEAD ORIG_HEAD
Previous: Junio C Hamano
Message 4 of 4 in “[Bug?] "git am --abort" loses previous "git add"”
  1. Junio C HamanoFeb 25, 2009
  2. git-am: Keep index in case of abort with dirty indexMichael J Gruber, Feb 26, 2009
  3. Junio C HamanoFeb 26, 2009
  4. git-am: make --abort less dangerousJunio C Hamano, Feb 26, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.