Subject: Re: [PATCHv3 0/5]rev-list and friends: --min-parents, --max-parents

From: Jonathan Nieder <[email-masked]>
Date: Thu, 24 Mar 2011 03:21:24 -0500

Michael J Gruber wrote:

> Compared to what is currently in pu (which is v2+eps), v3 has:

Thanks.  I reviewed this by looking at what Junio queued in pu; it
looks very good.  With the following patch, it passes tests.

The use of "return" was surprising.  It seems this style has been
intended to work ever since v0.99.5~24^2~4 (Trapping exit in tests,
using return for errors, 2005-08-10).

It interacts poorly with test_when_finished but since these tests do
not use that function, they should be safe.  test_when_finished could
use some fixes to avoid future surprises but that's another story.

-- 8< --
Subject: tests: avoid nonportable {foo,bar} glob

Unlike bash and ksh, dash and busybox ash do not support brace
expansion (as in 'echo {hello,world}').  So when dash is sh,
t6009.13 (set up dodecapus) ends up pass a string beginning with
"root{1,2," to "git merge" verbatim and the test fails.

Fix it by introducing a variable to hold the list of parents for
the dodecapus and populating it in a more low-tech way.

While at it, simplify a little by combining this setup code with the
test it sets up for.

Signed-off-by: Jonathan Nieder <[email-masked]>
---
 t/t6009-rev-list-parent.sh |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/t/t6009-rev-list-parent.sh b/t/t6009-rev-list-parent.sh
index fc89d6d..3050740 100755
--- a/t/t6009-rev-list-parent.sh
+++ b/t/t6009-rev-list-parent.sh
@@ -112,20 +112,20 @@ test_expect_success 'rev-list override and infinities' '
 	check_revlist "--max-parents=0 --min-parents=1 --no-min-parents" one five
 '
 
-test_expect_success 'set up dodecapus' '
+test_expect_success 'dodecapus' '
 
+	roots= &&
 	for i in 1 2 3 4 5 6 7 8 9 10 11
 	do
-		git checkout -b root$i five || return
-		test_commit $i || return
+		git checkout -b root$i five &&
+		test_commit $i &&
+		roots="$roots root$i" ||
+		return
 	done &&
 	git checkout master &&
 	test_tick &&
-	git merge -m dodecapus root{1,2,3,4,5,6,7,8,9,10,11} &&
-	git tag dodecapus
-'
-
-test_expect_success 'test with dodecapus' '
+	git merge -m dodecapus $roots &&
+	git tag dodecapus &&
 
 	check_revlist "--min-parents=4" dodecapus tetrapus &&
 	check_revlist "--min-parents=8" dodecapus &&
-- 
1.7.4.1