Subject: Re: [PATCH v6 2/2] mergetools: add winmerge as a builtin tool

From: Junio C Hamano <[email-masked]>
Date: Wed, 20 May 2015 13:13:15 -0700

David Aguilar <[email-masked]> writes:

> +	for directory in $(env | grep -Ei '^PROGRAM(FILES(\(X86\))?|W6432)=' |
> +		cut -d '=' -f 2- | sort -u)

Is the final "sort" really desired?  I am wondering if there are
fixed precedence/preference order among variants of %PROGRAMFILES% 
environment variables that the users on the platform are expected
to stick to, but the "sort" is sorting by the absolute pathnames of
where these things are, which may not reflect that order.

Not that I personally care too deeply, as I would expect that it is
likely any one of them found would just work fine ;-)

> +	do
> +		if test -n "$directory" && test -x "$directory/$winmerge_exe"
> +		then
> +			printf '%s' "$directory/$winmerge_exe"
> +			return
> +		fi
> +	done
> +
> +	printf WinMergeU.exe
> +}