From: Duy Nguyen Date: Mon, 02 Dec 2013 12:01:13 GMT Subject: Re: [PATCH] path_treatment: also ignore $GIT_DIR if it's not .git Message-ID: In-Reply-To: <1385984412.3240.17.camel@localhost> On Mon, Dec 2, 2013 at 6:40 PM, Dennis Kaarsemaker wrote: >> ~/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