From: Patrick Steinhardt Date: Fri, 20 Nov 2015 12:04:39 GMT Subject: [PATCH 1/2] rebase: test broken behavior with --keep-empty Message-ID: <1448021080-4994-2-git-send-email-ps@pks.im> In-Reply-To: <1448021080-4994-1-git-send-email-ps@pks.im> When a commit is already present in the branch that is being rebased upon we get an empty commit. Usually we just drop this commit, but with `--keep-empty` we want to preserve the commit's message. Instead of simply applying the empty commit, though, we erroneously end up in cherry-picking mode without any ability to get back to the previous rebase. The same error happens when we try to rebase a commit with `--keep-empty` that causes a conflict. Add tests that document this breakage. Signed-off-by: Patrick Steinhardt --- t/t3400-rebase.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index 47b5682..6cca319 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -255,4 +255,30 @@ test_expect_success 'rebase commit with an ancient timestamp' ' grep "author .* 34567 +0600$" actual ' +test_expect_failure 'rebase duplicated commit with --keep-empty' ' + git reset --hard && + git checkout master && + + >x && git add x && git commit x -mx && + echo x > x && git commit x -mx1 && + + git checkout -b duplicated HEAD~ && + echo x > x && git commit x -mx2 && + git rebase --keep-empty master +' + +test_expect_failure 'rebase conflicting commit with --keep-empty' ' + git reset --hard && + git checkout master && + + echo y > x && git commit x -my && + + git checkout -b conflict HEAD~ && + echo z > x && git commit x -mz && + test_must_fail git rebase --keep-empty master && + + git add x && + git rebase --continue +' + test_done -- 2.6.3