Re: [Bug report] git status doesn't escape paths of untracked files
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 8, 2020, 04:41 UTC
- Message-ID
- <xmqq1rjc284j.fsf@gitster.c.googlers.com>
- In-Reply-To
- <xmqq5z8p12ds.fsf@gitster.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 15 quoted lines
> "brian m. carlson" <sandals@crustytoothpaste.net> writes: > >> git-status(1) says: >> >> If a filename contains whitespace or other nonprintable characters, >> that field will be quoted in the manner of a C string literal: >> surrounded by ASCII double quote (34) characters, and with interior >> special characters backslash-escaped. >> >> Note that that differs from the standard behavior of not handling >> spaces, which I expect is due to the need to handle renames >> unambiguously. > > Not really. We use "rename from" and "rename to" extended header > lines in our output to unambiguously handle renamed paths.
Ah, I think I misunderstood you. We don't special case SP in what you called "the standard behaviour", i.e. "diff" output because we use "rename from/to", but a short format "status" that does not use NUL delimited output, we do need to give two paths, separate by whitespaces, and the quoting each path separately does help.