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>
Junio C Hamano committed
Feb 26, 2009 at 11:24 UTC
2d56a136435bd40f9b6b75103eb4d75003154c9f
1 file changed
+7
git-am.sh
+7
@@ -221,6 +221,9 @@ then
221
resume=yes
222
223
case "$skip,$abort" in
224
+ t,t)
225
+ die "Please make up your mind. --skip or --abort?"
226
+ ;;
227
t,)
228
git rerere clear
229
git read-tree --reset -u HEAD HEAD
@@ -229,6 +232,10 @@ then
232
git update-ref ORIG_HEAD $orig_head
233
;;
234
,t)
235
+ if test -f "$dotest/rebasing"
236
+ then
237
+ exec git rebase --abort
238
+ fi
239
git rerere clear
240
test -f "$dotest/dirtyindex" || {
241
git read-tree --reset -u HEAD ORIG_HEAD