From b096374f4a2cec0403378c1e9b4fb5fe37b517f4 Mon Sep 17 00:00:00 2001 From: Ian Ward Comfort Date: Tue, 8 Jun 2010 01:16:11 -0700 Subject: rebase -i: Abort cleanly if new base cannot be checked out Untracked content in the working tree may prevent rebase -i from checking out the new base onto which it wants to replay commits, if the new base commit includes files at those (now untracked) paths. Currently, rebase -i dies uncleanly in this situation, updating ORIG_HEAD and leaving a useless .git/rebase-merge directory, with which the user can do nothing useful except rebase --abort. Make rebase -i abort the procedure itself instead, as non-interactive rebase already does, and add a test for this behavior. Signed-off-by: Ian Ward Comfort Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index f20ea38411..8d409156d2 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 && -- cgit v1.2.3