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

Re: Crash on MSYS2 with GIT_WORK_TREE

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 8, 2017, 12:03 UTC
Message-ID
<alpine.DEB.2.20.1703081259150.3767@virtualbox>
In-Reply-To
<CAFKRc7ysOAOVx-7ww7MLF1qKpuKdJQqAtAhLJcYh3yMD3G2ncA@mail.gmail.com>
Hi valtron,
On Tue, 7 Mar 2017, valtron wrote:
> I only ran into this because of git-gui, where I eventually tracked it
> down to line 1330:
> 
>     set env(GIT_WORK_TREE) $_gitworktree

As git-gui is a Tcl script, which in turn runs as a pure Windows application, the path should use backslashes.

> With that line commented out, it works. I'll look into why git-gui
> sets it to a windows-path-with-forward-slashes, but that's a separate
> issue from the crash.
It is... please do contribute your fix when you have one.
> Also, from the stack trace, I think git is still able to understand the
> path, since it appears to correctly convert it to /c/repo, but I might
> be wrong since I haven't look at the code.

Git does not convert the path at all. It is the *MSYS2 runtime* that converts Windows paths to POSIX paths, if any. And it does so selectively. The current working directory is always transformed. PATH is always transformed. Environment variables are transformed *when they look like Windows paths*. And I am fairly certain that a GIT_WORK_TREE with a colon and forward-slashes fails that test: the MSYS2 runtime thinks this is not a Windows path and leaves it alone. Enter your problem.

Ciao, Johannes

Previous: valtronNext: Brandon Williams
Message 6 of 13 in “Crash on MSYS2 with GIT_WORK_TREE”
  1. valtronMar 7, 2017
  2. Johannes SchindelinMar 7, 2017
  3. Johannes SchindelinMar 8, 2017
  4. Johannes SchindelinMar 8, 2017
  5. valtronMar 8, 2017
  6. Johannes SchindelinMar 8, 2017
  7. Brandon WilliamsMar 8, 2017
  8. Johannes SchindelinMar 8, 2017
  9. Brandon WilliamsMar 8, 2017
  10. Junio C HamanoMar 8, 2017
  11. Junio C HamanoMar 8, 2017
  12. Johannes SchindelinMar 8, 2017
  13. Junio C HamanoMar 8, 2017

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.