Thread (1 message) 1 message, 1 author, 2020-09-08

Re: [Bug report] git status doesn't escape paths of untracked files

From: Junio C Hamano <hidden>
Date: 2020-09-08 01:13:51

Patrick Fong [off-list ref] writes:
What did you do before the bug happened? (Steps to reproduce your issue)
touch "this is escaped"
touch "this is not escaped"
git add "this is escaped"
git status --short

What did you expect to happen? (Expected behavior)
I expected that git status --short would string escape both "this is
escaped" and "this is not escaped" since they both contain spaces that
need escaping.

What happened instead? (Actual behavior)
git status did not string escape "this is not escaped" but it does if
you add it to the index.
It indeed is a disturbing inconsistency, and the code that shows the
untracked paths should be fixed.  I wonder what is done to ignored
paths when the "--ignored" option is given.

wt-status.c::wt_shortstatus_status() has a strange special case that
says "whitespace alone does not usually deserve quoting, but we
special case it and manually quote"; this discrepancy/special casing
was introduced at dbfdc625 (status: Quote paths with spaces in short
format, 2010-11-08).  A fix would probably be to port the same fix
to wt-status.c::wt_shortstatus_other().

In the longer term, quote.c::quote_path() may want to learn an
optional flag to tell it to do the the special casing.

Thanks.  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help