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
Karsten Blees <karsten.blees@gmail.com>
Date
Dec 3, 2013, 15:18 UTC
Message-ID
<529DF64A.70801@gmail.com>
In-Reply-To
<20131201190447.GA31367@kaarsemaker.net>
Am 01.12.2013 20:04, schrieb Dennis Kaarsemaker:
Show 15 quoted lines
> We always ignore anything named .git, but we should also ignore the git
> directory if the user overrides it by setting $GIT_DIR
> 
> Reported-By: Ingy döt Net <ingy@ingy.net>
> Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
> ---
>  dir.c             | 2 +-
>  t/t7508-status.sh | 7 +++++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/dir.c b/dir.c
> index 23b6de4..884b37d 100644
> --- a/dir.c
> +++ b/dir.c
> @@ -1198,7 +1198,7 @@ static enum path_treatment treat_path(struct dir_struct *dir,
The special case for ".git" is hardcoded in many places in git, including the line immediately above this diff hunk. So I figure that GIT_DIR is not meant to _rename_ the ".git" dir, but to point somewhere _outside_ the worktree (or somewhere within the .git dir).
If we want to support the rename case fully, I think there are a few more questions to answer (and a few more places to change), e.g.:
- What if GIT_DIR=.foo and someone upstream adds a ".foo" directory?
- Should it be possible to track ".git" as a normal file or directory if its not the GIT_DIR?
- What about other commands than status, e.g. does 'git clean -df' leave the GIT_DIR alone?
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.
Previous: Eric SunshineNext: Junio C Hamano
Message 14 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.