From 2d56a136435bd40f9b6b75103eb4d75003154c9f Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 26 Feb 2009 11:24:29 -0800 Subject: [PATCH] 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 --- git-am.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/git-am.sh b/git-am.sh index 351b4f86fa..d3390755fc 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 -- 2.11.4.GIT