Re: [PATCH] Fix t7601-merge-pull-config.sh on AIX
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:53
Miklos Vajna [off-list ref] writes:
quoted hunk
diff --git a/t/t7601-merge-pull-config.sh b/t/t7601-merge-pull-config.sh index 32585f8..12f71ad 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=`{ + eval $1=$({ git diff-files --name-only git ls-files --unmerged - } | wc -l` + } | wc -l | tr -d \ ) }
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)
and it is more natural to write count_conflicts like this:
count_conflicts () {
{
git diff-files --name-only --diff-filter=U
git ls-files --unmerged
} | wc -l
}
But I am puzzled about the alledged *breakage* -- look at your call
sites.
reset --hard
.. do a merge ..
conflict_count count_one
reset --hard
.. do another merge ..
conlict_count count_two
reset --hard
.. do yet another merge ..
conlict_count count_three
test "$count_three" = "$count_two"
At any point, you do not do numerical comparison, and I do not think extra
whitespace from other "wc" implementations matter, as long as they are
consistent.
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