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

Re: [PATCH] path_treatment: also ignore $GIT_DIR if it's not .git

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Dec 3, 2013, 19:07 UTC
Message-ID
<20131203190715.GC29959@google.com>
In-Reply-To
<xmqqtxepokej.fsf@gitster.dls.corp.google.com>
Junio C Hamano wrote:
> Karsten Blees <karsten.blees@gmail.com> writes:
Show 7 quoted lines
>> If we don't want to support this, though, I think it would be more
>> approrpiate to issue a warning if GIT_DIR points to a worktree
>> location.
>
> But how do tell what is and isn't a "worktree location"?  Having the
> path in the index would be one, but you may find it out only after
> issuing "git checkout $antient_commit".

I think the idea was that *any* path under $(git rev-parse --show-toplevel) would not be a valid GIT_DIR, unless its last path component is ".git".

Alas, I don't think that would work smoothly.
 - Some people may already be using GIT_DIR=$HOME/dotfiles.git to
   track some files with a toplevel of $HOME.  That is error-prone and
   it would be cleaner to either use plain .git or keep the $GIT_DIR
   outside the worktree (for example by tucking dotfiles into a
   separate $HOME/dotfiles dir), true, but producing a noisy warning
   with no way out would not serve these people well.
 - There is no outside-the-worktree location when GIT_WORK_TREE=/.

So your suggestion of at least noticing when "git checkout" wants to write files that overlap with the GIT_DIR seems simpler.

Previous: Karsten Blees
Message 17 of 17 in “GIT_DIR not auto ignored”
  1. Ingy dot NetDec 1, 2013
  2. Dennis KaarsemakerDec 1, 2013
  3. Dennis KaarsemakerDec 1, 2013
  4. path_treatment: also ignore $GIT_DIR if it's not .gitDennis Kaarsemaker, Dec 1, 2013
  5. Duy NguyenDec 1, 2013
  6. Thomas RastDec 1, 2013
  7. Dennis KaarsemakerDec 1, 2013
  8. Duy NguyenDec 2, 2013
  9. Dennis KaarsemakerDec 2, 2013
  10. Duy NguyenDec 2, 2013
  11. Dennis KaarsemakerDec 2, 2013
  12. Duy NguyenDec 2, 2013
  13. Eric SunshineDec 2, 2013
  14. Karsten BleesDec 3, 2013
  15. Junio C HamanoDec 3, 2013
  16. Karsten BleesDec 3, 2013
  17. Jonathan NiederDec 3, 2013

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.