Skip to content

Commit

Permalink
wt-status: collect ignored files
Browse files Browse the repository at this point in the history
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Apr 10, 2010
1 parent f5b26b1 commit 6cb3f6b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions wt-status.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void wt_status_prepare(struct wt_status *s)
s->index_file = get_index_file();
s->change.strdup_strings = 1;
s->untracked.strdup_strings = 1;
s->ignored.strdup_strings = 1;
}

static void wt_status_print_unmerged_header(struct wt_status *s)
Expand Down Expand Up @@ -382,6 +383,21 @@ static void wt_status_collect_untracked(struct wt_status *s)
free(ent);
}

if (s->show_ignored_files) {
dir.nr = 0;
dir.flags = DIR_SHOW_IGNORED | DIR_SHOW_OTHER_DIRECTORIES;
fill_directory(&dir, s->pathspec);
for (i = 0; i < dir.nr; i++) {
struct dir_entry *ent = dir.entries[i];
if (!cache_name_is_other(ent->name, ent->len))
continue;
if (!match_pathspec(s->pathspec, ent->name, ent->len, 0, NULL))
continue;
string_list_insert(ent->name, &s->ignored);
free(ent);
}
}

free(dir.entries);
}

Expand Down
2 changes: 2 additions & 0 deletions wt-status.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct wt_status {
int use_color;
int relative_paths;
int submodule_summary;
int show_ignored_files;
enum untracked_status_type show_untracked_files;
char color_palette[WT_STATUS_UNMERGED+1][COLOR_MAXLEN];

Expand All @@ -52,6 +53,7 @@ struct wt_status {
const char *prefix;
struct string_list change;
struct string_list untracked;
struct string_list ignored;
};

void wt_status_prepare(struct wt_status *s);
Expand Down

0 comments on commit 6cb3f6b

Please sign in to comment.