Subject: Re: [PATCH 16/19] mingw: avoid absolute path in t0008

From: Junio C Hamano <[email-masked]>
Date: Sun, 24 Jan 2016 18:11:02 -0800

Johannes Schindelin <[email-masked]> writes:

> From: Pat Thoyts <[email-masked]>
>
> The test separator char is a colon which means any absolute paths on
> Windows confuse the tests that use global_excludes.
>
> Suggested-by: Karsten Blees <[email-masked]>
> Signed-off-by: Pat Thoyts <[email-masked]>
> Signed-off-by: Johannes Schindelin <[email-masked]>
> ---
>  t/t0008-ignores.sh | 8 +++++++-

Is the fact that $global_excludes is specified using an absolute
path significant to the correctness of this test script?  This patch
suggests me that it is not (i.e. if the tests chdir's around, then
relative reference to global-excludes file would not work at all,
but apparently tests run with MINGW prereq does not exhibit such an
issue, so the remainder of the test would see the file we want it
see with the relative reference just fine).

And in that case, I think it would be more correct to use the
"global-excludes in the current directory" definition regardless of
MINGW prerequisite.  Adding a comment that says "The value of this
variable is a colon separated list, so avoid absolute path, because
..." is a very welcome addition while doing so.

A larger question is if it would make more sense for Git ported to
Windows environment to use semicolon (that is the element separator
for %PATH% in the Windows land, right?) instead where POSIXy port
would use colon as the separator.  A variable that is a list of
locations (e.g. $PATH) makes little sense when elements can only be
relative paths in practice.

>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh
> index 4ef5ed4..68749f5 100755
> --- a/t/t0008-ignores.sh
> +++ b/t/t0008-ignores.sh
> @@ -5,7 +5,13 @@ test_description=check-ignore
>  . ./test-lib.sh
>  
>  init_vars () {
> -	global_excludes="$(pwd)/global-excludes"
> +	# On Windows, avoid using "C:" in the global-excludes paths.
> +	if test_have_prereq MINGW
> +	then
> +		global_excludes="global-excludes"
> +	else
> +		global_excludes="$(pwd)/global-excludes"
> +	fi
>  }
>  
>  enable_global_excludes () {