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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michal Marek <mmarek@xxxxxxx> writes:

> 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@xxxxxxx>

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?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]