git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-checkout: Handle relative paths containing "..".

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 8, 2007, 14:25 UTC
Message-ID
<Pine.LNX.4.64.0711081420570.4362@racer.site>
In-Reply-To
<ee77f5c20711080510i138729b9vb0b9ad485cb2db3@mail.gmail.com>
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

Previous: David Symonds
Message 4 of 4 in “git-checkout: Handle relative paths containing "..".”
  1. git-checkout: Handle relative paths containing "..".David Symonds, Nov 8, 2007
  2. Junio C HamanoNov 8, 2007
  3. David SymondsNov 8, 2007
  4. Johannes SchindelinNov 8, 2007

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.