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

Re: Filename quoting / parsing problem

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 2, 2010, 18:37 UTC
Message-ID
<7v8wcge4kr.fsf@alter.siamese.dyndns.org>
In-Reply-To
<201001021236.26947.agruen@suse.de>
Andreas Gruenbacher <agruen@suse.de> writes:
Show 8 quoted lines
> On Friday 01 January 2010 09:01:19 pm Junio C Hamano wrote:
>> > 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.

You already realized that there is no ambiguity because "diff --git" lines are parsable and renames have explicit names. Why do you still maintain that we are allowing such "ambiguities" when there is none?

Show 5 quoted lines
>> 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,...

The only reason I said I don't think we would mind changing the trailing SP case is because the reduced risk of getting our patches corrupted by MUA _might_ outweigh the benefit of not quoting to avoid an eyesore [*1*].

But what you said would add to eyesore of quoted names (which you omitted from your quote) without any justification other than "I would prefer". The pros-and-cons in such a change is quite different; as we have already established that there is no ambiguity, "disambuguation" is not a "pro" in this comparison.

[Footnote]

*1* Strictly speaking, it is not just "an eyesore" that is an issue. Our diff output without renames are designed to be grokkable by other people's patch implementations (e.g. GNU patch), and the quoted pathnames are not understandable by them. Even though our final version of quoted path format came from the GNU diff/patch maintainer (back then, at least):

    http://article.gmane.org/gmane.comp.version-control.git/10103

I don't think it happened in the GNU land yet, and you would be the person to know about it ;-).

Previous: Andreas GruenbacherNext: Andreas Gruenbacher
Message 5 of 10 in “Filename quoting / parsing problem”
  1. Andreas GruenbacherJan 1, 2010
  2. Junio C HamanoJan 1, 2010
  3. Junio C HamanoJan 1, 2010
  4. Andreas GruenbacherJan 2, 2010
  5. Junio C HamanoJan 2, 2010
  6. Andreas GruenbacherJan 2, 2010
  7. Andreas GruenbacherJan 6, 2010
  8. Junio C HamanoJan 6, 2010
  9. Junio C HamanoJan 6, 2010
  10. Andreas SchwabJan 6, 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.