wt-status: collect ignored files
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Apr 10, 2010 at 00:11 UTC
6cb3f6b28294cb2b3766370f42a570fb46ba4e97
2 files changed
+18
wt-status.c
+16
@@ -42,6 +42,7 @@ void wt_status_prepare(struct wt_status *s)
42
s->index_file = get_index_file();
43
s->change.strdup_strings = 1;
44
s->untracked.strdup_strings = 1;
45
+ s->ignored.strdup_strings = 1;
46
}
47
48
static void wt_status_print_unmerged_header(struct wt_status *s)
@@ -382,6 +383,21 @@ static void wt_status_collect_untracked(struct wt_status *s)
383
free(ent);
384
}
385
386
+ if (s->show_ignored_files) {
387
+ dir.nr = 0;
388
+ dir.flags = DIR_SHOW_IGNORED | DIR_SHOW_OTHER_DIRECTORIES;
389
+ fill_directory(&dir, s->pathspec);
390
+ for (i = 0; i < dir.nr; i++) {
391
+ struct dir_entry *ent = dir.entries[i];
392
+ if (!cache_name_is_other(ent->name, ent->len))
393
+ continue;
394
+ if (!match_pathspec(s->pathspec, ent->name, ent->len, 0, NULL))
395
+ continue;
396
+ string_list_insert(ent->name, &s->ignored);
397
+ free(ent);
398
+ }
399
+ }
400
+
401
free(dir.entries);
402
}
403
wt-status.h
+2
@@ -41,6 +41,7 @@ struct wt_status {
41
int use_color;
42
int relative_paths;
43
int submodule_summary;
44
+ int show_ignored_files;
45
enum untracked_status_type show_untracked_files;
46
char color_palette[WT_STATUS_UNMERGED+1][COLOR_MAXLEN];
47
@@ -52,6 +53,7 @@ struct wt_status {
53
const char *prefix;
54
struct string_list change;
55
struct string_list untracked;
56
+ struct string_list ignored;
57
};
58
59
void wt_status_prepare(struct wt_status *s);