[PATCH v2 2/5] New test: no merges without preserve merges

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git@...>
Cc: <gitster@...>, Jörg Sommer <joerg@...>
Date: Saturday, March 22, 2008 - 10:08 am

This test checks that no merges are included, if --preserve-merges is not
given.

To see a difference between with and without merges add a second commit
to the branch to-be-preserved. Otherwise you exchange one merge with one
commit, which isn't cognizable with EXPECT_COUNT.

The for loop in the test looks somewhat strange, but I didn't saw a
different way (than || exit 1) to make the test fail if an inner test
fails. Recall: The exit code of a for loop is the exit code of the last
command in the last pass, i.e. “for a in 1 2; do test $a != 1; do”
returns success.

Signed-off-by: Jörg Sommer <joerg@alea.gnuu.de>
---
 t/t3404-rebase-interactive.sh |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

This patch must be applied after the first patch that fixes rebase,
because it triggers a bug.

diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 9cf873f..8de1f21 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -195,6 +195,9 @@ test_expect_success 'preserve merges with -p' '
 	git add unrelated-file &&
 	test_tick &&
 	git commit -m "unrelated" &&
+	echo 2 > unrelated-file &&
+	test_tick &&
+	git commit -m "second unrelated commit" unrelated-file &&
 	git checkout -b to-be-rebased master &&
 	echo B > file1 &&
 	test_tick &&
@@ -212,6 +215,18 @@ test_expect_success 'preserve merges with -p' '
 	test $(git show HEAD~2:file1) = B
 '
 
+test_expect_success 'no merges without preserve merges' '
+	head=$(git rev-parse HEAD) &&
+	test_tick &&
+	EXPECT_COUNT=4 git rebase -i branch1 &&
+	test $(git rev-parse HEAD) != $head &&
+        for i in 0 1 2 3
+	do
+		test $? -eq 0 &&
+		test "$(git rev-list --parents -1 HEAD~$i | tr -dc " ")" = " "
+	done
+'
+
 test_expect_success '--continue tries to commit' '
 	test_tick &&
 	! git rebase -i --onto new-branch1 HEAD^ &&
-- 
1.5.4.4

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] rebase with preserve merges should not show merg..., Johannes Schindelin, (Fri Mar 21, 9:33 pm)
Re: [PATCH] rebase with preserve merges should not show merg..., Johannes Schindelin, (Sat Mar 22, 7:22 am)
Re: [PATCH v2 1/5] rebase with preserve merges should not sh..., Johannes Schindelin, (Sat Mar 22, 10:46 am)
[PATCH v2 2/5] New test: no merges without preserve merges, Jörg Sommer, (Sat Mar 22, 10:08 am)
[PATCH v2 3/5] , Jörg Sommer, (Sat Mar 22, 10:08 am)
[PATCH] , Jörg Sommer, (Fri Mar 21, 9:19 pm)
[PATCH] New tests to check rebase with preserve merges, Jörg Sommer, (Fri Mar 21, 9:19 pm)