aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-06-21 06:02:50 -0700
committerJunio C Hamano <gitster@pobox.com>2010-06-21 06:02:50 -0700
commit9cb16a92d7c069b36f7b7b08557f779de499d3f7 (patch)
treec20c4be6ad5c89092e4d88912269f0b590c04494
parent542ed78232ecbb1099eee5e3a4f1add0a2faa8d3 (diff)
parentb096374f4a2cec0403378c1e9b4fb5fe37b517f4 (diff)
downloadgit-9cb16a92d7c069b36f7b7b08557f779de499d3f7.tar.gz
git-9cb16a92d7c069b36f7b7b08557f779de499d3f7.tar.xz
Merge branch 'ic/maint-rebase-i-abort'
* ic/maint-rebase-i-abort: rebase -i: Abort cleanly if new base cannot be checked out
-rwxr-xr-xgit-rebase--interactive.sh3
-rwxr-xr-xt/t3404-rebase-interactive.sh10
2 files changed, 12 insertions, 1 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 436b7f597..6b86abc64 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -974,8 +974,9 @@ EOF
test -d "$REWRITTEN" || test -n "$NEVER_FF" || skip_unnecessary_picks
+ output git checkout $ONTO || die_abort "could not detach HEAD"
git update-ref ORIG_HEAD $HEAD
- output git checkout $ONTO && do_rest
+ do_rest
;;
esac
shift
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 6668907ec..ee9a1b25e 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -146,6 +146,16 @@ test_expect_success 'abort' '
! test -d .git/rebase-merge
'
+test_expect_success 'abort with error when new base cannot be checked out' '
+ git rm --cached file1 &&
+ git commit -m "remove file in base" &&
+ test_must_fail git rebase -i master > output 2>&1 &&
+ grep "Untracked working tree file .file1. would be overwritten" \
+ output &&
+ ! test -d .git/rebase-merge &&
+ git reset --hard HEAD^
+'
+
test_expect_success 'retain authorship' '
echo A > file7 &&
git add file7 &&