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

Re: [PATCH] setup: set env $GIT_WORK_TREE when work tree is set, like $GIT_DIR

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 26, 2015, 19:02 UTC
Message-ID
<xmqqk2uqthrh.fsf@gitster.dls.corp.google.com>
In-Reply-To
<xmqqpp4iv1au.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 11 quoted lines
> But I am not sure if it is true for our children (e.g. hooks,
> filters etc. that is spawned by us).  With this change, they inherit
> GIT_WORK_TREE and no GIT_DIR, in such a case.  If they set GIT_DIR
> themselves for their own use, perhaps arranging to work in somewhere
> else they know by chdir'ing there, they did not have to set
> GIT_WORK_TREE=. before runing git in there, but now they do, because
> we start exporting GIT_WORK_TREE to interfere what they have been
> doing.
>
> "It does not harm" is probably false for our children, I would
> think.  The children can do new things to avoid the harm, though.

Actually, I think I am overly and unnecessarily worried in the above.

We do not do anything special wrt existing GIT_ environment variables the user exported into us when spawning hooks or filters; if existing scripts wanted to visit a different repository and interact with it while they do their work, they would have already been seeing these variables in their environment inherited from us, and they should have been protecting themselves from these settings anyway. So I do not think this patch breaks anything (other than such scripts that are already broken).

So, sorry for a false alarm.  Queued.
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 7 in “Linked workdirs break typo-correction.”
  1. Bjørnar SnoksrudJun 25, 2015
  2. setup: set env $GIT_WORK_TREE when work tree is set, like $GIT_DIRNguyễn Thái Ngọc Duy, Jun 26, 2015
  3. Jeff KingJun 26, 2015
  4. Duy NguyenJun 27, 2015
  5. Junio C HamanoJun 26, 2015
  6. Junio C HamanoJun 26, 2015
  7. Junio C HamanoJun 26, 2015

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.