Subject: Re: [PATCH 1/2] tests(gpg): allow the gpg-agent to start on Windows

From: Junio C Hamano <[email-masked]>
Date: Mon, 23 Mar 2020 10:46:44 -0700

"Johannes Schindelin via GitGitGadget" <[email-masked]>
writes:

> From: Johannes Schindelin <[email-masked]>
>
> In Git for Windows' SDK, we use the MSYS2 version of OpenSSH, meaning
> that the `gpg-agent` will fail horribly when being passed a `--homedir`
> that contains colons.
>
> Previously, we did pass the Windows version of the absolute path,
> though, which starts in the drive letter followed by, you guessed it, a
> colon.
>
> Let's use the same trick found elsewhere in our test suite where `$PWD`
> is used to refer to the pseudo-Unix path (which works only within the
> MSYS2 Bash/OpenSSH/Perl/etc, as opposed to `$(pwd)` which refers to the
> Windows path that `git.exe` understands, too).

Makes sense.  

Do we have a short/concise instruction, e.g. "You should use $(pwd)
in most cases, but for such and such purposes use $PWD instead", in
t/README for test writers, who are not familiar with the distinction
between $(pwd) and $PWD, to help them decide which one to use in
what situation?  I see this kind of fix-ups from time to time, and
am wondering if there is a way to reduce the need for you or J6t to
spot and fix the new ones.

Thanks.

> Signed-off-by: Johannes Schindelin <[email-masked]>
> ---
>  t/lib-gpg.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
> index 8d28652b729..11b83b8c24a 100755
> --- a/t/lib-gpg.sh
> +++ b/t/lib-gpg.sh
> @@ -29,7 +29,7 @@ then
>  		#		> lib-gpg/ownertrust
>  		mkdir ./gpghome &&
>  		chmod 0700 ./gpghome &&
> -		GNUPGHOME="$(pwd)/gpghome" &&
> +		GNUPGHOME="$PWD/gpghome" &&
>  		export GNUPGHOME &&
>  		(gpgconf --kill gpg-agent >/dev/null 2>&1 || : ) &&
>  		gpg --homedir "${GNUPGHOME}" 2>/dev/null --import \