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

[BUG/RFC] Git Gui: GIT_DIR leaks to spawned Git Bash

From
Max Kirillov <max@max630.net>
Date
Jan 16, 2017, 22:40 UTC
Message-ID
<20170116224022.GA8539@jessie.local>
Hello.

Apparently various GIT_* environment variables (most interesting is GIT_DIR but AFAIR there were more) leak to shell session launched from Git Gui's "Git Bash" menu item. Which can cause unexpected results if user navigates in that shell to some other repository (in can also include starting another terminal window etc. to make user forget original context) and tries to do something there.

I think is would be appropriate to clean up the environment while starting any program from git gui. It may have downside that the environment could be set intentionally, and now is's removed, but (1) there seems to be no way to distinguish intentionally vs automatically set GIT_DIR, and (2) the spawned program may be intended to be used independly even if the environment was set intentionally for git gui.

But I would like to note that I find it wrong for the "git" dispatcher to set up any enrironment to the spawned command-specific executable. Because it mixes the concerns of that variables - are they user-settable variables to tweak the git's behavior, or internal ones to transport the discovered paths and other info to scripts which cannot do the standard discovery? Not clear. There has been bugs related to that already, for example [1].

[1] https://public-inbox.org/git/1409784120-2228-1-git-send-email-max@max630.net/
-- 
Max
Next: Johannes Schindelin
Message 1 of 4 in “[BUG/RFC] Git Gui: GIT_DIR leaks to spawned Git Bash”
  1. Max KirillovJan 16, 2017
  2. Johannes SchindelinJan 17, 2017
  3. Max KirillovJan 17, 2017
  4. Johannes SchindelinJan 18, 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.