git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] (experimental) diff --quote-path-with-sp
@ 2021-09-15 22:33 Junio C Hamano
  2021-09-15 22:33 ` [PATCH 1/2] diff: simplify quote_two() Junio C Hamano
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Junio C Hamano @ 2021-09-15 22:33 UTC (permalink / raw)
  To: git

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"

We have always done this enclosing inside dq when the pathname had
an even more difficult byte (like LF, double quotes, and HT), so we
know Git tools can handle such a patch output just fine already.

 *1* https://lore.kernel.org/git/87ek6s0w34.fsf@penguin.cs.ucla.edu/
 *2* https://lore.kernel.org/git/YR9Iaj%2FFqAyCMade@tilde.club/


Junio C Hamano (2):
  diff: simplify quote_two()
  diff: --quote-path-with-sp

 Documentation/diff-options.txt |  5 +++++
 diff.c                         | 26 ++++++++++----------------
 diff.h                         |  1 +
 quote.c                        | 23 ++++++++++++++++++-----
 quote.h                        |  3 ++-
 t/t3902-quoted.sh              | 24 +++++++++++++++++++++++-
 6 files changed, 59 insertions(+), 23 deletions(-)

-- 
2.33.0-649-gd4f4107c2b


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-16 20:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15 22:33 [PATCH 0/2] (experimental) diff --quote-path-with-sp Junio C Hamano
2021-09-15 22:33 ` [PATCH 1/2] diff: simplify quote_two() Junio C Hamano
2021-09-15 22:33 ` [PATCH 2/2] diff: --quote-path-with-sp Junio C Hamano
2021-09-16  9:06   ` Ævar Arnfjörð Bjarmason
2021-09-16 20:59     ` Junio C Hamano
2021-09-16  3:33 ` [PATCH 0/2] (experimental) diff --quote-path-with-sp Gwyneth Morgan
2021-09-16  5:31   ` Junio C Hamano

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).