Signed-off-by: Jörg Sommer <joerg@xxxxxxxxxxxx> --- t/t3404-rebase-interactive.sh | 52 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 52 insertions(+), 0 deletions(-) > > > > > > Please mark such tests with test_expect_fail. > > > > No, I expect the test succeeds. Currently, it fails. This might be, > > because my expectations are wrong or there's a bug. > > The definition of "test_expect_fail" is: this should succeed, but needs > fixin'. Ahh, I didn't know this. Here's a new one: diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 62e65d7..c849415 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -362,4 +362,56 @@ test_expect_success 'rebase with a file named HEAD in worktree' ' ' +test_expect_success 'squash and preserve merges' ' + test_tick && + git checkout -b squash-and-preserve-merges master && + echo A > file1 && + git commit -m SaPM-1 file1 && + echo B > file1 && + git commit -m SaPM-2 file1 && + git merge to-be-preserved && + echo C > file1 && + git commit -m SaPM-3 file1 +' + +# This test should fail, because the prompt includes the commit from the +# merge not only the merge: +# -> pick 9604163 unrelated +# pick 5ef0364 SaPM-1 +# pick 22aadcf SaPM-2 +# pick 828f7d8 Merge branch 'to-be-preserved' into squash-and-preserve-merges +# pick 2a15a54 SaPM-3 +test_expect_failure 'expect preserve merges shown not commits from merge' ' + EXPECT_COUNT=4 FAKE_LINES="1 2 squash 4 3" \ + git rebase -i -p --onto branch1 master || + { git rebase --abort; + EXPECT_COUNT=5 FAKE_LINES="1 2 3 squash 5 4" \ + git rebase -i -p --onto branch1 master; + false; } +' + +# The rebase changes nothing: SaPM-3 is still the last commit while it +# should have been merged with SaMP-2 and the branch is not rebased on +# branch1 +# +# % git forest squash-and-preserve-merges +# ╓─[squash-and-preserve-merges]──SaPM-3 +# ╟ Merge branch 'to-be-preserved' into squash-and-preserve-merges +# ╠═╗ +# ╟ ║ SaPM-2 +# ╟ ║ SaPM-1 +# ║ ╟─[to-be-preserved]──unrelated +# ╟─║─[master]──E +# ╠═╝ +# ╟ D +# ╟ C +# ╟ B +# ╙─[A]──A +test_expect_failure 'squash and preserve merges' ' + test $(git rev-parse HEAD^2) = $(git rev-parse to-be-preserved) && + test $(git rev-parse HEAD~3) = $(git rev-parse branch1) && + test $(git show HEAD:file1) = C && + test $(git show HEAD~2:file1) = A +' + test_done -- 1.5.4.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html