Re: [PATCH 2/2] t/README: hint about using $(pwd) rather than $PWD in tests
> This adds just a "do it this way" instruction without a lot of explanation,
> because the details are too complex to be explained at this point.
Thanks, looks very useful.
Show 12 quoted lines
> --- a/t/README
> +++ b/t/README
> @@ -283,6 +283,12 @@ Do:
> Tests that are likely to smoke out future regressions are better
> than tests that just inflate the coverage metrics.
>
> + - When a test checks for an absolute path that a git command generated,
> + construct the expected value using $(pwd) rather than $PWD,
> + $TEST_DIRECTORY, or $TRASH_DIRECTORY. It makes a difference on
> + Windows, where the shell (MSYS bash) mangles absolute path names.
> + For details, see the commit message of 4114156ae9.
> +
Perhaps it is also worth explaining the cases where $PWD is needed?
By contrast, when a passing a path to git or constructing a URL,
use $PWD. It makes a difference on Windows, where
- $(pwd) is a Windows-style path such as git might output, and
- $PWD is a Unix-style path that the shell (MSYS bash) will
mangle before passing to native apps like git.