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

Re: [PATCH] Handle double slashes in make_relative_path()

From
Robin Rosenberg <robin.rosenberg@dewire.com>
Date
Jan 25, 2010, 01:06 UTC
Message-ID
<201001250206.48138.robin.rosenberg@dewire.com>
In-Reply-To
<7v8wbn8ie2.fsf@alter.siamese.dyndns.org>
söndagen den 24 januari 2010 19.31.01 skrev  Junio C Hamano:
Show 33 quoted lines
> Johannes Sixt <j6t@kdbg.org> writes:
> > On Samstag, 23. Januar 2010, Johannes Sixt wrote:
> >> On Samstag, 23. Januar 2010, Junio C Hamano wrote:
> >> > What happens if you did this?
> >> >
> >> > 	git --git-dir=//git/repo/repo.git --work-tree=/git/repo
> >> >
> >> > where "//git/repo" is on the "git server" and you are working in local
> >> > hierarchy "/git/repo"?
> >>
> >> Ah, right, this would not do the right thing. (But I can't verify this
> >> claim right now.)
> >
> > I tested it, and it does the right thing. The reason is that before
> > setup_work_tree() calls make_relative_path(), the --work-tree argument
> > has been processed by make_absolute_path(), which adds the drive prefix.
> >
> > As long as setup_work_tree() remains the only caller of
> > make_relative_path(), we are safe.
> 
> Thanks; I think a more correct description of your findings is:
> 
>  - msysgit's make_absolute_path() does the right thing (i.e. adds "drive
>    prefix" to "git/repo" given to --work-tree); and
> 
>  - as long as the callers feed what the platform considers absolute paths
>    in abs and base, make_relative_path() does the right thing.
> 
> So I think we are Ok.  We _might_ want to add Windows-only test at the
> beginning of make_relative_path() to make sure that the both inputs have
> double-slashes at the beginning to catch future broken callers, but I
> think that is a separate topic, and we don't have to do that as long as
> setup_work_tree(0 remains the only caller, as you said.
Separate patch posted since this problem occurs in more than one place. 
-- robin
Previous: Junio C HamanoNext: Thomas Rast
Message 18 of 20 in “Handle double slashes in make_relative_path()”
  1. Handle double slashes in make_relative_path()Thomas Rast, Jan 22, 2010
  2. Junio C HamanoJan 22, 2010
  3. Junio C HamanoJan 22, 2010
  4. Johannes SixtJan 22, 2010
  5. Robin RosenbergJan 23, 2010
  6. Johannes SixtJan 23, 2010
  7. Robin RosenbergJan 23, 2010
  8. Johannes SixtJan 23, 2010
  9. Junio C HamanoJan 23, 2010
  10. Junio C HamanoJan 23, 2010
  11. Johannes SixtJan 23, 2010
  12. Sverre RabbelierJan 23, 2010
  13. Thomas RastJan 24, 2010
  14. Bernhard R. LinkJan 24, 2010
  15. Junio C HamanoJan 24, 2010
  16. Johannes SixtJan 24, 2010
  17. Junio C HamanoJan 24, 2010
  18. Robin RosenbergJan 25, 2010
  19. Thomas RastJan 22, 2010
  20. Junio C HamanoJan 22, 2010

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.