Re: [PATCH] t7500: fix tests with absolute path following ":(optional)" on Windows
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Oct 20, 2025, 17:39 UTC
- Message-ID
- <CAPig+cTP1ARNMQmxZh9_YO0pDOsFZ1Z2HTa+Bo=58O-voL9hXA@mail.gmail.com>
- In-Reply-To
- <A563E028-19E7-48A0-B538-82ACE821DB67@gmail.com>
On Mon, Oct 20, 2025 at 9:44 AM Ben Knoble <ben.knoble@gmail.com> wrote:
Show 11 quoted lines
> > Le 20 oct. 2025 à 05:40, Johannes Sixt <j6t@kdbg.org> a écrit : > > On Windows, the MSYS layer translates absolute path names generated by > > a shell script from the POSIX style /c/dir/file to the Windows style > > C:/dir/file form that is understood by git.exe. This happens only when > > the absolute path stands on its own as a program argument or a value of > > an environment variable. > > [...] > > Going forward I will probably stick with using pwd, given the difference in platform behavior. > > Is there a doc or test lint for that? If not, might be useful.
The use of $PWD versus $(pwd) is documented in t/README:
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.(Though, it might have been nicer if it described the behavior in more detail rather than referring the reader elsewhere.)