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

Re: [RFC/PATCH v2 1/3] sh-setup: export GIT_DIR

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 23, 2014, 20:18 UTC
Message-ID
<xmqqwqefyf3l.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140423200150.GA31356@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 21 quoted lines
> On Wed, Apr 23, 2014 at 02:42:38PM -0500, Felipe Contreras wrote:
>
>> It is what the clients of this library expect.
>
> Is it? Passing GIT_DIR to sub-invocations of git will change how they
> determine the repo and working tree. Your patch seems to cause failures
> all over the test suite.
>
> Without looking too hard, I'd guess the problems are one of:
>
>   1. Setting GIT_DIR fixes the repo directory for all sub-invocations. A
>      script that does "cd some-other-repo.git && git ...". You'd need to
>      teach calling scripts to unset GIT_DIR when trying to move to
>      another repo.
>
>   2. If GIT_DIR is set but GIT_WORK_TREE is not, then GIT_WORK_TREE will
>      default to ".". It might be sufficient to set GIT_WORK_TREE when
>      you are setting GIT_DIR here. But as I said, I didn't look too
>      hard, so there might be other complications.
>
> -Peff

I do not recall the details but I do remember that it is very deliberate not to export GIT_DIR but only set in git-sh-setup.

Previous: Jeff KingNext: Felipe Contreras
Message 4 of 12 in “New 'update-branch' hook”
  1. 0/3 New 'update-branch' hookFelipe Contreras, Apr 23, 2014
  2. 1/3 sh-setup: export GIT_DIRFelipe Contreras, Apr 23, 2014
  3. Jeff KingApr 23, 2014
  4. Junio C HamanoApr 23, 2014
  5. 2/3 run-command: make sure hooks have always GIT_DIRFelipe Contreras, Apr 23, 2014
  6. Junio C HamanoApr 23, 2014
  7. Felipe ContrerasApr 23, 2014
  8. 3/3 Add 'update-branch' hookFelipe Contreras, Apr 23, 2014
  9. Junio C HamanoApr 23, 2014
  10. Felipe ContrerasApr 23, 2014
  11. Junio C HamanoApr 23, 2014
  12. Felipe ContrerasApr 23, 2014

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.