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

Re: [PATCH] apply: handle filenames with double slashes better

From
Junio C Hamano <gitster@pobox.com>
Date
May 21, 2009, 14:56 UTC
Message-ID
<7vd4a2bj3p.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20090521122511.GA31614@sepie.suse.cz>
Michal Marek <mmarek@suse.cz> writes:
Show 14 quoted lines
> Collapse double slashes to make patches like this work with --index or
> --cached:
>
> git apply --index <<-EOF
> 	--- a/perl//Git.pm
> 	+++ b/perl//Git.pm
> 	@@ -1358,3 +1358,4 @@
>
>
> 	 1; # Famous last words
> 	+# test
> EOF
>
> Signed-off-by: Michal Marek <mmarek@suse.cz>
Hmm, I do not know if this is a good change.

For duplicate slashes in paths, I do not think there is any other sensible way to handle them other than squashing them together, but naming the function to do so "canon_name()" would tempt people to add other not-so-clearly-sensible "canonicalization" such as turning "./a" to "a" (which we shouldn't --- we should treat "./" as one level so that we keep behaving in a similar way as "patch -p1" does) or "a/../b" to "b".

Also calling this in find_name() loses information too early in the processing; how bad would it look if you move the callsite of this duplicate slash squashing down the callchain where the names are actually used?

Previous: Michal MarekNext: Michal Marek
Message 2 of 5 in “apply: handle filenames with double slashes better”
  1. apply: handle filenames with double slashes betterMichal Marek, May 21, 2009
  2. Junio C HamanoMay 21, 2009
  3. Michal MarekMay 21, 2009
  4. Junio C HamanoMay 21, 2009
  5. Michal MarekMay 25, 2009

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.