Subject: Re: git format-patch produces invalid patch if the commit adds an empty file?

From: Junio C Hamano <[email-masked]>
Date: Fri, 20 Aug 2021 14:09:46 -0700

Gwyneth Morgan <[email-masked]> writes:

> GNU patch chokes in this case with an unquoted filename with spaces.

When we settled what bytes (not characters) in a pathname will cause
it to be quoted and how the quoting is done between us and GNU diff
and patch maintainer back in Oct 2005, I thought that we excluded
whitespace from the bytes that need quoting [*].  And I do not
recall us changing the rule for pathname quoting since then (other
than introduction of core.quotepath to disable quoting bytes with
the 8th bit set).

It may be a "recent" change on the GNU patch side, and I do not
think we mind tweaking our diff output to be more accomodating iff
that observation is true.  I however understand that spaces in
pathnames are not so uncommon especially among non-programmers and
they may feel irritating having to see any pathname with spaces
quoted.

[Reference]

* https://lore.kernel.org/git/[email-masked]/