git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Michal Marek <mmarek@suse.cz>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] apply: handle filenames with double slashes better
Date: Thu, 21 May 2009 07:56:10 -0700	[thread overview]
Message-ID: <7vd4a2bj3p.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20090521122511.GA31614@sepie.suse.cz> (Michal Marek's message of "Thu\, 21 May 2009 14\:25\:11 +0200")

Michal Marek <mmarek@suse.cz> 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@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?

  reply	other threads:[~2009-05-21 14:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-21 12:25 [PATCH] apply: handle filenames with double slashes better Michal Marek
2009-05-21 14:56 ` Junio C Hamano [this message]
2009-05-21 19:12   ` Michal Marek
2009-05-21 19:22     ` Junio C Hamano
2009-05-25  9:11       ` Michal Marek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vd4a2bj3p.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).