Skip to content

Commit 07966ed

Browse files
jamillgitster
authored andcommitted
status: report matching ignored and normal untracked
Teach status command to handle `--ignored=matching` with `--untracked-files=normal` Signed-off-by: Jameson Miller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent eec0f7f commit 07966ed

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

dir.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,6 +1585,7 @@ static enum path_treatment treat_one_path(struct dir_struct *dir,
15851585
{
15861586
int exclude;
15871587
int has_path_in_index = !!index_file_exists(istate, path->buf, path->len, ignore_case);
1588+
enum path_treatment path_treatment;
15881589

15891590
if (dtype == DT_UNKNOWN)
15901591
dtype = get_dtype(de, istate, path->buf, path->len);
@@ -1631,8 +1632,23 @@ static enum path_treatment treat_one_path(struct dir_struct *dir,
16311632
return path_none;
16321633
case DT_DIR:
16331634
strbuf_addch(path, '/');
1634-
return treat_directory(dir, istate, untracked, path->buf, path->len,
1635-
baselen, exclude, pathspec);
1635+
path_treatment = treat_directory(dir, istate, untracked,
1636+
path->buf, path->len,
1637+
baselen, exclude, pathspec);
1638+
/*
1639+
* If 1) we only want to return directories that
1640+
* match an exclude pattern and 2) this directory does
1641+
* not match an exclude pattern but all of its
1642+
* contents are excluded, then indicate that we should
1643+
* recurse into this directory (instead of marking the
1644+
* directory itself as an ignored path).
1645+
*/
1646+
if (!exclude &&
1647+
path_treatment == path_excluded &&
1648+
(dir->flags & DIR_SHOW_IGNORED_TOO) &&
1649+
(dir->flags & DIR_SHOW_IGNORED_TOO_MODE_MATCHING))
1650+
return path_recurse;
1651+
return path_treatment;
16361652
case DT_REG:
16371653
case DT_LNK:
16381654
return exclude ? path_excluded : path_untracked;

0 commit comments

Comments
 (0)