From: Kevin Ballard <kevin@sb.org>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Kevin Ballard <kevin@sb.org>
Subject: [PATCH] status: Quote paths with spaces in short format
Date: Mon, 8 Nov 2010 18:44:38 -0800 [thread overview]
Message-ID: <1289270678-89237-1-git-send-email-kevin@sb.org> (raw)
In-Reply-To: <A2E979E4-899B-4295-A8CF-72EF8E585D3A@sb.org>
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>
---
This patch was originally attached via scissors to message id
<A2E979E4-899B-4295-A8CF-72EF8E585D3A@sb.org> but it appears to have
been overlooked.
wt-status.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index fc2438f..9624865 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);
}
--
1.7.3.2.203.ge51db
prev parent reply other threads:[~2010-11-09 2:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 23:57 `git status --porcelain` disagrees with documentation about quoting filenames with spaces Kevin Ballard
2010-10-28 18:44 ` Junio C Hamano
2010-10-28 21:17 ` Kevin Ballard
2010-10-28 23:41 ` Junio C Hamano
2010-10-29 0:41 ` Kevin Ballard
[not found] ` <7vaalx9430.fsf@alter.siamese.dyndns.org>
2010-10-29 1:51 ` Kevin Ballard
2010-11-09 2:44 ` Kevin Ballard [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1289270678-89237-1-git-send-email-kevin@sb.org \
--to=kevin@sb.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).