status: report matching ignored and normal untracked

Teach status command to handle `--ignored=matching` with `--untracked-files=normal` Signed-off-by: Jameson Miller <jamill@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jameson Miller committed Oct 30, 2017 at 13:21 UTC 07966ed19ed6936442bdb9cf40f315369e78bd0d
1 file changed +18 -2
dir.c
+18 -2
@@ -1585,6 +1585,7 @@ static enum path_treatment treat_one_path(struct dir_struct *dir,
1585 {
1586 int exclude;
1587 int has_path_in_index = !!index_file_exists(istate, path->buf, path->len, ignore_case);
1588 + enum path_treatment path_treatment;
1589
1590 if (dtype == DT_UNKNOWN)
1591 dtype = get_dtype(de, istate, path->buf, path->len);
@@ -1631,8 +1632,23 @@ static enum path_treatment treat_one_path(struct dir_struct *dir,
1632 return path_none;
1633 case DT_DIR:
1634 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;
1652 case DT_REG:
1653 case DT_LNK:
1654 return exclude ? path_excluded : path_untracked;