Re: [PATCH] setup: return correct prefix if worktree is '/'
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Mar 25, 2011, 15:11 UTC
- Message-ID
- <AANLkTi=tZiVvBPy-VoTp+nWTPTrvpgY9OBPR-D0b7K5-@mail.gmail.com>
- In-Reply-To
- <4D8CA3EF.3010403@drmicha.warpmail.net>
2011/3/25 Michael J Gruber <git@drmicha.warpmail.net>:
> Wait wait, the bug bisects to > > 490544b (get_cwd_relative(): do not misinterpret suffix as subdirectory, > 2010-05-22)
Well, we've had a few bugs in this area lately :) That one was fixed by fbbb4e1 (get_cwd_relative(): do not misinterpret root path - 2010-11-20), which was also noticed by Mathijs.
Show 15 quoted lines
> for me, using
>
> git bisect run sh -c "make || exit 125; cd /etc; GIT_DIR=/tmp/a/.git
> ~/src/git/git-add fstab || exit 1"
>
> and a repo in /tmp/a/.git with core.worktree set to "/".
>
> The issue is that in get_relative_cwd() of dir.c, "dir" (and maybe
> ("cwd") may or may not end in "/", so even with dir="/etc/" and
> cwd="/etc" we would not recognize we are within the repo. Patch for that
> is coming.
>
> Note that by doing something like the above, we can test / without being
> root as long as we have files there which we can rely on being readable,
> or can rely on /tmp being there.Sounds good, as long as we stick to standard paths, like /etc/fstab. But that won't work on Windows. I don't even know if any file is always at a known location in C:\.
-- Duy