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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Miklos Vajna <vmiklos@xxxxxxxxxxxxxx> writes:

> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux