Re: [PATCH] Preserve cwd in setup_git_directory()
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jul 24, 2008, 14:09 UTC
- Message-ID
- <alpine.DEB.1.00.0807241506340.8986@racer>
- In-Reply-To
- <fcaeb9bf0807240540i400fe0d1s7ea8efe72203471d@mail.gmail.com>
Hi,
On Thu, 24 Jul 2008, Nguyen Thai Ngoc Duy wrote:
Show 14 quoted lines
> On 7/24/08, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote: > > > On Thu, 24 Jul 2008, Nguyen Thai Ngoc Duy wrote: > > > > > When GIT_DIR is not set, cwd is used to determine where .git is. If > > > core.worktree is set, setup_git_directory() needs to jump back to > > > the original cwd in order to calculate worktree, this leads to > > > incorrect .git location later in setup_work_tree(). > > > > I do not understand. core.worktree is either absolute, in which case > > there is no problem. Or it is relative to where the config lives, no? > > The problem is GIT_DIR is not absolute in this case. So cwd must stay > where git dir is until it is absolute-ized by setup_work_tree().
I do not see GIT_DIR being set in your test case at all.
I do not see how get_git_work_tree() ro get_relative_cwd() should ever be allowed to chdir().
_If_ they were (which I strongly doubt), they should chdir() back themselves.
I now wasted easily 30 minutes just trying to make sense of your patch and your response. And I am still puzzled.
Your commit message was of no help.
This patch is definitely the opposite of "obviously correct".
Ciao, Dscho