Skip to content

Commit 2d56a13

Browse files
committed
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 <gitster@pobox.com>
1 parent c767184 commit 2d56a13

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

git-am.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ then
221221
resume=yes
222222

223223
case "$skip,$abort" in
224+
t,t)
225+
die "Please make up your mind. --skip or --abort?"
226+
;;
224227
t,)
225228
git rerere clear
226229
git read-tree --reset -u HEAD HEAD
@@ -229,6 +232,10 @@ then
229232
git update-ref ORIG_HEAD $orig_head
230233
;;
231234
,t)
235+
if test -f "$dotest/rebasing"
236+
then
237+
exec git rebase --abort
238+
fi
232239
git rerere clear
233240
test -f "$dotest/dirtyindex" || {
234241
git read-tree --reset -u HEAD ORIG_HEAD

0 commit comments

Comments
 (0)