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

Re: [PATCH 0/2] (experimental) diff --quote-path-with-sp

From
Gwyneth Morgan <gwymor@tilde.club>
Date
Sep 16, 2021, 03:33 UTC
Message-ID
<YUK7Bl9uzNE1YErg@tilde.club>
In-Reply-To
<20210915223316.1653443-1-gitster@pobox.com>
On 2021-09-15 15:33:14-0700, Junio C Hamano wrote:
Show 14 quoted lines
> Long time ago, we had a discussion with GNU patch/diff maintainer
> and agreed that pathnames with certain "difficult" bytes needs to be
> quoted to ensure the resulting patch is machine parseable in an
> unambiguous way [*1*].  Recently, we saw a report that found that
> GNU patch is unhappy with our diff output for a path with SP in it
> [*2*].
> 
> With this experimental option, the beginning part of the patch
> output will have pathnames with SP in them enclosed inside a pair of
> double quotes, like so:
> 
> 	diff --git "a/A Name" "b/A Name"
> 	--- "a/A Name"
> 	+++ "b/A Name"

I believe GNU patch is fine with unquoted spaces in the "--- a/path" and "+++ b/path", and only has an issue with unquoted spaces in the "diff --git" line. busybox patch does seem to have an issue with quoted filenames in the "---" and "+++" lines but is fine if those lines are unquoted. Maybe we could leave spaces unquoted in those lines, only quoted if there's some other character that needs it.

Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 7 in “(experimental) diff --quote-path-with-sp”
  1. 0/2 (experimental) diff --quote-path-with-spJunio C Hamano, Sep 15, 2021
  2. 2/2 diff: --quote-path-with-spJunio C Hamano, Sep 15, 2021
  3. Ævar Arnfjörð BjarmasonSep 16, 2021
  4. Junio C HamanoSep 16, 2021
  5. 1/2 diff: simplify quote_two()Junio C Hamano, Sep 15, 2021
  6. Gwyneth MorganSep 16, 2021
  7. Junio C HamanoSep 16, 2021

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.