git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 5/5] tests: explicitly use `git.exe` on Windows

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 14, 2018, 14:47 UTC
Message-ID
<xmqqefbnn2be.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<nycvar.QRO.7.76.6.1811141422270.39@tvgsbejvaqbjf.bet>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 31 quoted lines
>> The latter half of this change is a good one.  Given what the
>> proposed log message of this patch says
>> 
>>     Note also: the many, many calls to `git this` and `git that` are
>>     unaffected, as the regular PATH search will find the `.exe` files on
>>     Windows (and not be confused by a directory of the name `git` that is
>>     in one of the directories listed in the `PATH` variable), while
>>     `/path/to/git` would not, per se, know that it is looking for an
>>     executable and happily prefer such a directory.
>> 
>> which I read as "path-prefixed invocation, i.e. some/path/to/git, is
>> bad, it must be spelled some/path/to/git.exe", I am surprised that
>> tests ever worked on Windows without these five patches, as this
>> line used to read like this:
>> 
>> 	"$GIT_BUILD_DIR/git" >/dev/null
>> 	if test $? != 1
>> 	then
>> 		...
>> 
>> Wouldn't "$GIT_BUILD_DIR/git" have failed (and "executable not
>> found" hopefully won't produce exit code 1) and stopped the test
>> suite from running even after you built git and not under the
>> test-installed-git mode?
>
> "$GIT_BUILD_DIR/git" did not fail until I regularly built with Visual
> Studio (and my Visual Studio project generator generates a directory named
> "git" to live alongside "git.exe").
>
> And when it failed, I patched Git for Windows. Fast-forward, years later I
> managed to contribute the patch we are discussing right now ;-)

OK, I still cannot read it out of what you wrote in the proposed log message without aid, but in essense the crux of the problem is that invoking "some/path/to/git" finds "some/path/to/git.exe" only when there is no "some/path/to/git" directory at the same time, and if that directory exists, tries and fails to execute that directory, and the change in this patch protects us from that problem.

Did I get it right? I'd really prefer to see it more clearly written in the log message so the next person who reads "git log" do not have to ask the same question to you.

Assuming that I read it correctly, I think this patch as a whole makes tons of sense as a change to make the invocation more robust.

Thanks.
Previous: Johannes SchindelinNext: Johannes Schindelin via GitGitGadget
Message 21 of 27 in “tests: various improvements to the GIT_TEST_INSTALLED feature”
  1. 0/5 tests: various improvements to the GIT_TEST_INSTALLED featureJohannes Schindelin via GitGitGadget, Nov 12, 2018
  2. 1/5 tests: fix GIT_TEST_INSTALLED's PATH to include t/helper/Johannes Schindelin via GitGitGadget, Nov 12, 2018
  3. Junio C HamanoNov 14, 2018
  4. 3/5 t/lib-gettext: test installed git-sh-i18n if GIT_TEST_INSTALLED is setJohannes Schindelin via GitGitGadget, Nov 12, 2018
  5. Junio C HamanoNov 14, 2018
  6. 2/5 tests: respect GIT_TEST_INSTALLED when initializing repositoriesJohannes Schindelin via GitGitGadget, Nov 12, 2018
  7. Junio C HamanoNov 14, 2018
  8. Johannes SchindelinNov 14, 2018
  9. Junio C HamanoNov 14, 2018
  10. Jeff KingNov 14, 2018
  11. Johannes SchindelinNov 15, 2018
  12. Jeff KingNov 15, 2018
  13. 4/5 tests: do not require Git to be built when testing an installed GitJohannes Schindelin via GitGitGadget, Nov 12, 2018
  14. Junio C HamanoNov 14, 2018
  15. Johannes SchindelinNov 14, 2018
  16. Jeff KingNov 14, 2018
  17. Johannes SchindelinNov 14, 2018
  18. 5/5 tests: explicitly use `git.exe` on WindowsJohannes Schindelin via GitGitGadget, Nov 12, 2018
  19. Junio C HamanoNov 14, 2018
  20. Johannes SchindelinNov 14, 2018
  21. Junio C HamanoNov 14, 2018
  22. 0/5 tests: various improvements to the GIT_TEST_INSTALLED featureJohannes Schindelin via GitGitGadget, Nov 14, 2018
  23. 1/5 tests: fix GIT_TEST_INSTALLED's PATH to include t/helper/Johannes Schindelin via GitGitGadget, Nov 14, 2018
  24. 2/5 tests: respect GIT_TEST_INSTALLED when initializing repositoriesJohannes Schindelin via GitGitGadget, Nov 14, 2018
  25. 3/5 t/lib-gettext: test installed git-sh-i18n if GIT_TEST_INSTALLED is setJohannes Schindelin via GitGitGadget, Nov 14, 2018
  26. 4/5 tests: do not require Git to be built when testing an installed GitJohannes Schindelin via GitGitGadget, Nov 14, 2018
  27. 5/5 tests: explicitly use `git.exe` on WindowsJohannes Schindelin via GitGitGadget, Nov 14, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.