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
Duy Nguyen <pclouds@gmail.com>
Date
Dec 2, 2013, 12:01 UTC
Message-ID
<CACsJy8Afhr1syRW8UetKKHss2r9e2pN2dCmc99Aj9418SxAUMg@mail.gmail.com>
In-Reply-To
<1385984412.3240.17.camel@localhost>

On Mon, Dec 2, 2013 at 6:40 PM, Dennis Kaarsemaker <dennis@kaarsemaker.net> wrote:

Show 24 quoted lines
>> ~/w/git $ cd t
>> ~/w/git/t $ GIT_TRACE_SETUP=1 ../git --git-dir=../.git --work-tree=..
>> --no-pager status
>> setup: git_dir: /home/pclouds/w/git/.git
>> setup: worktree: /home/pclouds/w/git
>> setup: cwd: /home/pclouds/w/git
>> setup: prefix: t/
>> On branch exclude-pathspec
>> Your branch and 'origin/master' have diverged,
>> and have 2 and 5 different commits each, respectively.
>>
>> I can't say this is the only case though. One has to audit to all
>> possible setup cases in setup_git_directory() to make that claim.
>
> I'm probably missing something, but that's the same as my second
> example, and works. I also tried running it from completely outside the
> repo:
>
> dennis@lightning:~$ code/git/git --git-dir=code/git/.foo --work-tree=code/git status
> On branch master
> nothing to commit, working directory clean
> dennis@lightning:~$ code/git/git --git-dir=/home/dennis/code/git/.foo --work-tree=code/git status
> On branch master
> nothing to commit, working directory clean

It looks like we try to convert git_dir relative to work_tree (in setup_work_tree) so get_git_dir() probably always returns a path relative to worktree if it's set. I don't know, it looks like so.

-- 
Duy
Previous: Dennis KaarsemakerNext: Eric Sunshine
Message 12 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.