Re: [PATCH] git-checkout: Handle relative paths containing "..".
Hi,
On Fri, 9 Nov 2007, David Symonds wrote:
Show 8 quoted lines
> On Nov 8, 2007 7:30 PM, Junio C Hamano <junio@pobox.com> wrote:
> >
> > Have you tested this patch from the toplevel of any tree, where
> > "git-rev-parse --show-cdup" would yield an empty string?
>
> No, I didn't. Arguably, "git-rev-parse --show-cdup" should always return
> a path to the top-level, which would make this kind of construction much
> simpler.
As it is, we have a convenience function for this, to make it much simpler: cd_to_toplevel in git-sh-setup.
Show 6 quoted lines
> > I also wonder how this patch (with an obvious fix to address the above
> > point) would interact with GIT_DIR and/or GIT_WORK_TREE in the
> > environment.
>
> No idea. I'm still learning my way around the git codebase, so I was
> hoping for some review and feedback from more experienced Gits.
It _should_ work with GIT_DIR/GIT_WORK_TREE, as the full name is relative to the project root, and that's exactly where cd_to_toplevel is jumping to. And the first call to ls-files should make certain that the paths are correct, so there should be no confusion either.
But yes, I have been burnt by that work tree stuff too many times, so I'd appreciate tests for that (both positive and negative ones).
Ciao, Dscho