threads / rfc / 14299

RFC patchFix t7601-merge-pull-config.sh on AIX

Subject: [RFC/PATCH] Fix t7601-merge-pull-config.sh on AIX

## tl;dr

2 messages between Jul 5, 2008 and Jul 6, 2008. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Miklos Vajna· Jul 5, 2008, 14:23 UTC · lore

The test failed on AIX (and likely other OS, such as apparently OSX) where wc -l outputs whitespace.

Also, avoid unnecessary eval in conflict_count().
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
On Fri, Jul 04, 2008 at 06:49:03PM -0700, Junio C Hamano <gitster@pobox.com> wrote:
Show 10 quoted lines
> In any case, this feels like an unnecessary use of eval.  The call
> site
> you have look like this:
>
>       conflict_count resolve_count
>
> but it is more natural if you are programming in shell to call it
> like:
>
>       resolve_count=$(count_conflicts)
Changed.
> If you are going to do numerical comparison in later versions, you can
> just drop the dq around parameters of test:
>
>       test $count_three = $count_two
Changed.
Mike, could you please confirm that this solves your problem as well?
 t/t7601-merge-pull-config.sh |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
Show changes to t/t7601-merge-pull-config.sh +7 −7
diff --git a/t/t7601-merge-pull-config.sh b/t/t7601-merge-pull-config.sh
index 32585f8..95b4d71 100755
--- a/t/t7601-merge-pull-config.sh
+++ b/t/t7601-merge-pull-config.sh
@@ -70,10 +70,10 @@ test_expect_success 'merge c1 with c2 and c3 (recursive and octopus in pull.octo
 
 conflict_count()
 {
-	eval $1=`{
+	{
 		git diff-files --name-only
 		git ls-files --unmerged
-	} | wc -l`
+	} | wc -l
 }
 
 # c4 - c5
@@ -115,15 +115,15 @@ test_expect_success 'merge picks up the best result' '
 	git config pull.twohead "recursive resolve" &&
 	git reset --hard c5 &&
 	git merge -s resolve c6
-	conflict_count resolve_count &&
+	resolve_count=$(conflict_count) &&
 	git reset --hard c5 &&
 	git merge -s recursive c6
-	conflict_count recursive_count &&
+	recursive_count=$(conflict_count) &&
 	git reset --hard c5 &&
 	git merge c6
-	conflict_count auto_count &&
-	test "$auto_count" = "$recursive_count" &&
-	test "$auto_count" != "$resolve_count"
+	auto_count=$(conflict_count) &&
+	test $auto_count = $recursive_count &&
+	test $auto_count != $resolve_count
 '
 
 test_done
-- 
1.5.6.1.322.ge904b.dirty
Brian Gernhardt· Jul 6, 2008, 08:15 UTC · re: Miklos Vajna · lore

Re: [RFC/PATCH] Fix t7601-merge-pull-config.sh on AIX

On Jul 5, 2008, at 10:23 AM, Miklos Vajna wrote:
> The test failed on AIX (and likely other OS, such as apparently OSX)
> where wc -l outputs whitespace.
ACK.  This test does break on OS X and this patch fixes it.

Took me a while to realize why it was saying "8: command not found". Apparently "resolve_count= 8" means something very different than "resolve_count=8". Then I remembered seeing a patch recently that hit conflict_count and I didn't have to think about how to fix it.

Thanks, ~~ Brian

← back to recent threads