[PATCH 1/3] Prepare for non-interactive merge-preserving rebase
- From
Andreas Ericsson <ae@op5.se>
- Date
- Sep 23, 2008, 20:57 UTC
- Message-ID
- <48D95836.6040200@op5.se>
This patch adds two tests (really three, but one of them just handles setup) which we currently expect to fail.
One of them tests "git rebase -p", without the -i flag, to make sure it works without phony editors and suchlike.
The other tests "git pull --rebase --preserve-merges" to make sure that the same functionality exists there.
The test was originally written by Stephen Habermann <stephen@exigencecorp.com> but has been significantly modified since its creation.
Signed-off-by: Andreas Ericsson <ae@op5.se> ---
Stephen, I had to modify the tests a bit to get them to work with how I implemented the merge-preserving rebase, and also to remove a lot of the cruft that was previously in there. Hope you're ok with the attribution in the commit message.
t/t3409-rebase-preserve-merges.sh | 68 +++++++++++++++++++++++++++++++++++++ 1 files changed, 68 insertions(+), 0 deletions(-) create mode 100644 t/t3409-rebase-preserve-merges.sh
diff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh new file mode 100644 index 0000000..532b220 --- /dev/null +++ b/t/t3409-rebase-preserve-merges.sh @@ -0,0 +1,68 @@ +#!/bin/sh +# +# Copyright(C) 2008 Stephen Habermann & Andreas Ericsson +# +test_description='git rebase -p should preserve merges + +This test runs various incantations of "git rebase -p" and checks +that merges are properly carried along +' +. ./test-lib.sh + +GIT_AUTHOR_EMAIL=bogus_email_address +export GIT_AUTHOR_EMAIL + +#echo 'Setting up: +# +#A1--A2 <-- origin/master +# \ \ +# B1--M <-- topic +# \ +# B2 <-- origin/topic +# +#' + +test_expect_success 'setup for merge-preserving rebase' \ + 'echo First > A && + git add A && + git-commit -m "Add A1" && + git checkout -b topic && + echo Second > B && + git add B && + git-commit -m "Add B1" && + git checkout -f master && + echo Third >> A && + git-commit -a -m "Modify A2" && + + git clone ./. clone1 && + cd clone1 && + git checkout -b topic origin/topic && + git merge origin/master && + cd .. + + git clone ./. clone2 + cd clone2 && + git checkout -b topic origin/topic && + git merge origin/master && + cd .. && + + git checkout topic && + echo Fourth >> B && + git commit -a -m "Modify B2" +' + +test_expect_failure 'git pull --rebase -p on moved topic' ' + cd clone1 && + git pull --rebase --preserve-merges && + test $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) = 1 +' + +test_expect_failure 'rebase -p merge on moved topic' ' + cd ../clone2 && + git fetch && + git rebase -p origin/topic && + test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) && + test 1 = $(git rev-list --all --pretty=oneline | grep "Merge commit" | wc -l) +' + +test_done
-- 1.6.0.2.307.gc4275.dirty