git rebase --abort: always restore the right commit
Previously, --abort would end by git resetting to ORIG_HEAD, but some commands, such as git reset --hard (which happened in git rebase --skip, but could just as well be typed by the user), would have already modified ORIG_HEAD. Just use the orig-head we store in $dotest instead. Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Mike Hommey committed
Mar 1, 2008 at 11:32 UTC
48411d2233aec65b612ac2b1f50540ec60f0f568
2 files changed
+3
-4
git-rebase.sh
+2
-3
@@ -208,16 +208,15 @@ do
208
if test -d "$dotest"
209
then
210
move_to_original_branch
211
- rm -r "$dotest"
211
elif test -d .dotest
212
then
213
dotest=.dotest
214
move_to_original_branch
216
- rm -r .dotest
215
else
216
die "No rebase in progress?"
217
fi
220
- git reset --hard ORIG_HEAD
218
+ git reset --hard $(cat $dotest/orig-head)
219
+ rm -r "$dotest"
220
exit
221
;;
222
--onto)
t/t3407-rebase-abort.sh
+1
-1
@@ -29,7 +29,7 @@ test_expect_success 'rebase --abort' '
29
test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase)
30
'
31
32
-test_expect_failure 'rebase --abort after --skip' '
32
+test_expect_success 'rebase --abort after --skip' '
33
# Clean up the state from the previous one
34
git reset --hard pre-rebase
35
rm -rf .dotest