Re: [Bug report] git status doesn't escape paths of untracked files
From: Junio C Hamano <hidden>
Date: 2020-09-08 01:30:33
"brian m. carlson" [off-list ref] 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. cquote was indeed invented to serve "diff" output (actually, nice things in the internal implementation of Git from the early years were all invented to serve the diff machinery), but we deliberately excluded SP from the set of characters that needs quoting because it was thought to be reasonably common, compared to things like HT. I agree with your "the special case handling needs to be taught to the wt_shortstatus_other()"; a refactored helper function called by both places would help. Thanks.