summaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
authorKevin Ballard <kevin@sb.org>2010-11-08 18:44:38 -0800
committerJunio C Hamano <gitster@pobox.com>2010-11-09 07:35:16 -0800
commitdbfdc625a5aad10c47e3ffa446d0b92e341a7b44 (patch)
treeb11e4e81356430aa164063656097c2492369e8e4 /wt-status.c
parentaf77aee9cac51c2036e6019b4aebec2049f03e6b (diff)
downloadgit-dbfdc625a5aad10c47e3ffa446d0b92e341a7b44.tar.gz
status: Quote paths with spaces in short format
According to the documentation for git-status, in short-format mode, paths with spaces or unprintable characters are quoted. However 28fba29 (Do not quote SP., 2005-10-17) removed the behavior that quotes paths that have spaces but not unprintable characters. Unfortunately this makes the output of `git status --porcelain` non-parseable in certain (rather unusual) edge cases. In the interest of removing ambiguity when parsing the output of `git status --porcelain`, restore the behavior of quoting paths with spaces in git-status's short-format mode. Signed-off-by: Kevin Ballard <kevin@sb.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/wt-status.c b/wt-status.c
index fc2438f60b..9624865e21 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -744,10 +744,20 @@ static void wt_shortstatus_status(int null_termination, struct string_list_item
const char *one;
if (d->head_path) {
one = quote_path(d->head_path, -1, &onebuf, s->prefix);
+ if (*one != '"' && strchr(one, ' ') != NULL) {
+ putchar('"');
+ strbuf_addch(&onebuf, '"');
+ one = onebuf.buf;
+ }
printf("%s -> ", one);
strbuf_release(&onebuf);
}
one = quote_path(it->string, -1, &onebuf, s->prefix);
+ if (*one != '"' && strchr(one, ' ') != NULL) {
+ putchar('"');
+ strbuf_addch(&onebuf, '"');
+ one = onebuf.buf;
+ }
printf("%s\n", one);
strbuf_release(&onebuf);
}