From: Jeff King Date: Fri, 7 Dec 2007 16:57:04 +0000 (-0500) Subject: wt-status.c:quote_path(): convert empty path to "./" X-Git-Tag: v1.5.4-rc0~51 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c3ce3261281d00bcdd59907e76f421034ccb1261;p=git.git wt-status.c:quote_path(): convert empty path to "./" Now that we are correctly removing leading prefixes from files in git status, there is a degenerate case: the directory matching the prefix. Because we show only the directory name for a directory that contains only untracked files, it gets collapsed to an empty string. Example: $ git init $ mkdir subdir $ touch subdir/file $ git status ... # Untracked files: # (use "git add ..." to include in what will be committed) # # subdir/ So far, so good. $ cd subdir $ git status .... # Untracked files: # (use "git add ..." to include in what will be committed) # # Oops, that's a bit confusing. This patch prints './' to show that there is some output. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- diff --git a/wt-status.c b/wt-status.c index 02dbb751d..05414bb9e 100644 --- a/wt-status.c +++ b/wt-status.c @@ -121,6 +121,9 @@ static char *quote_path(const char *in, int len, } } + if (!out->len) + strbuf_addstr(out, "./"); + return out->buf; }