Skip to content

Commit

Permalink
git-am: make --abort less dangerous
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Feb 27, 2009
1 parent c767184 commit 2d56a13
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions git-am.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2d56a13

Please sign in to comment.