From: Andreas Gruenbacher <agruen@suse.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: Filename quoting / parsing problem
Date: Sat, 2 Jan 2010 12:36:26 +0100 [thread overview]
Message-ID: <201001021236.26947.agruen@suse.de> (raw)
In-Reply-To: <7vr5q9lhm8.fsf@alter.siamese.dyndns.org>
On Friday 01 January 2010 09:01:19 pm Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
> > I used "cat -e" to make it easier to see that "c file " not only has SP
> > in it but it has trailing space. Let's try the result.
> >
> > $ git diff --cached | cat -e
> > diff --git "a/a\001file" "b/a\001file"$
> > new file mode 100644$
> > index 0000000..e69de29$
> > diff --git a/b file b/b file$
> > new file mode 100644$
> > index 0000000..e69de29$
> > diff --git a/c file b/c file $
> > new file mode 100644$
> > index 0000000..e69de29$
> > $ git diff --cached >P.diff
> >
> > And as you described, "b file" and "c file " are not quoted and they do
> > not have ---/+++ lines.
> >
> > But observe this:
> > ...
> > We are now back in the state without any of these files, and P.diff
> > records a patch to recreate these three files, one with quoting and the
> > other two without.
> >
> > $ git apply --index P.diff
> > $ git ls-files -s | cat -e
> > 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0
> > "a\001file"$ 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 b
> > file$ 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 c file $
> > 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 hello$
> >
> > This demonstrates that The claim below is false, doesn't it?
> >
> > > Not parseable:
> > > diff --git a/baz b/baz
> > > new file mode 100644
> > > index 0000000..e69de29
> >
> > Both "b file" and "c file " are parsed by "git apply" perfectly fine.
Right, the "diff --git" lines are technically still parseable when the file
name stays the same. With renames, lines like "diff --git a/f a/f b/f" or
"diff --git a/f b/f b/f" are possible, but then there will also be "renamed
from" and "renamed to" headers which will disambiguate things. Still, it
doesn't seem like a good idea to allow such ambiguities in the first place.
> Having said all that, I don't think we would mind a change to treat a
> pathname with trailing SP a bit specially (iow, quoting "c file " in the
> above failed attempt to reproduce the issue).
I would prefer quoting file names which contain spaces anywhere, not only at
the end. If quoting helps to disambiguate a program's output, I'm all for it.
People who can't be bothered with such details can always use a pretty printer
(side by side view, whatever).
Thanks,
Andreas
next prev parent reply other threads:[~2010-01-02 11:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-01 17:44 Filename quoting / parsing problem Andreas Gruenbacher
2010-01-01 19:50 ` Junio C Hamano
2010-01-01 20:01 ` Junio C Hamano
2010-01-02 11:36 ` Andreas Gruenbacher [this message]
2010-01-02 18:37 ` Junio C Hamano
2010-01-02 20:48 ` Andreas Gruenbacher
2010-01-06 0:04 ` Andreas Gruenbacher
2010-01-06 1:32 ` Junio C Hamano
2010-01-06 1:08 ` Junio C Hamano
2010-01-06 10:06 ` Andreas Schwab
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=201001021236.26947.agruen@suse.de \
--to=agruen@suse.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).