From: Ben Knoble Date: Mon, 20 Oct 2025 13:43:55 GMT Subject: Re: [PATCH] t7500: fix tests with absolute path following ":(optional)" on Windows Message-ID: In-Reply-To: <6a83c7d1-7cd4-432e-a0ab-7b18ce3af08d@kdbg.org> > Le 20 oct. 2025 à 05:40, Johannes Sixt 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. > > The earlier commits 749d6d166d (config: values of pathname type can be > prefixed with :(optional), 2025-09-28) and ccfcaf399f (parseopt: values > of pathname type can be prefixed with :(optional), 2025-09-28) added > test cases where ":(optional)" is inserted before an absolute path. > $PWD is used to construct the absolute paths, which gives the POSIX > form, and the result is ":(optional)/c/dir/template". Such command line > arguments are no longer recognized as absolute paths and do not undergo > translation. > > Existing test cases that expect that the specified file does not exist > are not incorrect (after all, git.exe will not find /c/dir/template). > Yet, they are conceptually incorrect. That the use of $PWD is erroneous > is revealed by a test case that expects that the optional file exists. > Since no such test case is present, add one. Use "$(pwd)" to generate > the absolute paths, so that the command line arguments become > ":(optional)C:/dir/template". Thanks! I probably assumed there was no meaningful difference between the value of PWD and what pwd computes, so (prematurely) optimized for a lookup over executing a command. 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.