Re: More git status --porcelain lossage
From: Jeff King <hidden>
Date: 2016-06-15 22:48:35
On Fri, Apr 09, 2010 at 03:06:01PM -0400, Eric Raymond wrote:
A format properly designed for script parseability should use even use whitespace as a field separator. Why? Because if you do that, front ends *will* do field analysis using a naive split-on-whitespace operation. And then...someday...someone will try to run one of these of these on a volume from a system where filenames contain embedded whitespace. Like Mac OS X or Windows.
Yes, that is why almost every scriptable git interface supports a "-z" variant with NUL termination.
Conclusion: As it is presently, git status --porcelain format is irretrievably botched. You need a field separator that's musch less likely to land in a filename, like '|' - and to warn in the documentation that careful front ends must check for and ignore '\|'.
We already quote correctly, so it is only sloppy parsers that will be in trouble. Yes, space is more common than "|", but sloppy is sloppy. Parse it right, or use "-z". -Peff