summaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-04-10 00:33:17 -0700
committerJunio C Hamano <gitster@pobox.com>2010-04-10 00:43:59 -0700
commit2381e39e5ff740883b98c5aca019950f9167b67f (patch)
tree156a09a3f719d1a1d9bfa4f8a65e6e3d93c13065 /wt-status.c
parent1b908b6fb48f4f8009804c097b14106df548247c (diff)
downloadgit-2381e39e5ff740883b98c5aca019950f9167b67f.tar.gz
status: --ignored option shows ignored files
There is no stronger reason behind the choice of "!!" than just I happened to have typed them. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/wt-status.c b/wt-status.c
index 2c9a05dcb4..7bda9953e0 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -646,9 +646,11 @@ void wt_status_print(struct wt_status *s)
wt_status_print_submodule_summary(s, 0); /* staged */
wt_status_print_submodule_summary(s, 1); /* unstaged */
}
- if (s->show_untracked_files)
+ if (s->show_untracked_files) {
wt_status_print_other(s, &s->untracked, "Untracked", "add");
- else if (s->commitable)
+ if (s->show_ignored_files)
+ wt_status_print_other(s, &s->ignored, "Ignored", "add -f");
+ } else if (s->commitable)
fprintf(s->fp, "# Untracked files not listed (use -u option to show untracked files)\n");
if (s->verbose)
@@ -730,16 +732,16 @@ static void wt_shortstatus_status(int null_termination, struct string_list_item
}
}
-static void wt_shortstatus_untracked(int null_termination, struct string_list_item *it,
- struct wt_status *s)
+static void wt_shortstatus_other(int null_termination, struct string_list_item *it,
+ struct wt_status *s, const char *sign)
{
if (null_termination) {
- fprintf(stdout, "?? %s%c", it->string, 0);
+ fprintf(stdout, "%s %s%c", sign, it->string, 0);
} else {
struct strbuf onebuf = STRBUF_INIT;
const char *one;
one = quote_path(it->string, -1, &onebuf, s->prefix);
- color_fprintf(s->fp, color(WT_STATUS_UNTRACKED, s), "??");
+ color_fprintf(s->fp, color(WT_STATUS_UNTRACKED, s), sign);
printf(" %s\n", one);
strbuf_release(&onebuf);
}
@@ -763,7 +765,13 @@ void wt_shortstatus_print(struct wt_status *s, int null_termination)
struct string_list_item *it;
it = &(s->untracked.items[i]);
- wt_shortstatus_untracked(null_termination, it, s);
+ wt_shortstatus_other(null_termination, it, s, "??");
+ }
+ for (i = 0; i < s->ignored.nr; i++) {
+ struct string_list_item *it;
+
+ it = &(s->ignored.items[i]);
+ wt_shortstatus_other(null_termination, it, s, "!!");
}
}