summaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2007-12-07 16:57:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-12-08 11:33:24 (GMT)
commitc3ce3261281d00bcdd59907e76f421034ccb1261 (patch)
tree6f7468783cc443dbd6993b511dba7e9c12b227fc /wt-status.c
parent235997c90fe8648ac199f9a1ae257e06c145c131 (diff)
downloadgit-c3ce3261281d00bcdd59907e76f421034ccb1261.zip
git-c3ce3261281d00bcdd59907e76f421034ccb1261.tar.gz
git-c3ce3261281d00bcdd59907e76f421034ccb1261.tar.bz2
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 <file>..." to include in what will be committed) # # subdir/ So far, so good. $ cd subdir $ git status .... # Untracked files: # (use "git add <file>..." 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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/wt-status.c b/wt-status.c
index 02dbb75..05414bb 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;
}