Junio C Hamano  committed 2d56a13

git-am: make --abort less dangerous

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

  • Participants
  • Parent commits c767184

Comments (0)

Files changed (1)

 	case "$skip,$abort" in
+	t,t)
+		die "Please make up your mind. --skip or --abort?"
+		;;
 		git rerere clear
 		git read-tree --reset -u HEAD HEAD
 		git update-ref ORIG_HEAD $orig_head
+		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