Re: More git status --porcelain lossage
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Apr 9, 2010, 19:22 UTC
- Message-ID
- <m3ochsh1oc.fsf@localhost.localdomain>
- In-Reply-To
- <20100409190601.47B37475FEF@snark.thyrsus.com>
Eric Raymond <esr@snark.thyrsus.com> writes:
Show 18 quoted lines
> After I posted my last, I noticed another crash landing... > > 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. > > Hilarity will ensue. > > 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 '\|'.
Or follow what other porcelain does, like git-diff-tree raw output format, where all fields except final filename are space separated, filename is separated by tab character (or NUL when '-z' options is used). If there are two names (in the case of copy or renames), they are separated by a tab (or NUL). Record ends with LF (or NUL).
When '-z' option is not used, TAB, LF, " and backslash characters are represented by '\t', '\n', '\"' and \\, and the filename is enclosed in '"' doublequotes.
-- Jakub Narebski Poland ShadeHawk on #git