From: Junio C Hamano Date: Mon, 13 Nov 2017 05:44:59 +0000 (+0900) Subject: Merge branch 'jm/status-ignored-files-list' X-Git-Tag: v2.16.0-rc0~140 X-Git-Url: http://git.bitbasher.net/?a=commitdiff_plain;h=d8df70f2739af78cab6d7f9b942e890da6fbd01d;p=git.git Merge branch 'jm/status-ignored-files-list' The set of paths output from "git status --ignored" was tied closely with its "--untracked=" option, but now it can be controlled more flexibly. Most notably, a directory that is ignored because it is listed to be ignored in the ignore/exclude mechanism can be handled differently from a directory that ends up to be ignored only because all files in it are ignored. * jm/status-ignored-files-list: status: test ignored modes status: document options to show matching ignored files status: report matching ignored and normal untracked status: add option to show ignored files differently --- d8df70f2739af78cab6d7f9b942e890da6fbd01d diff --cc dir.c index fc2bdc79fc,20457724c0..047a950f55 --- a/dir.c +++ b/dir.c @@@ -1389,10 -1389,34 +1389,34 @@@ static enum path_treatment treat_direct case index_nonexistent: if (dir->flags & DIR_SHOW_OTHER_DIRECTORIES) break; + if (exclude && + (dir->flags & DIR_SHOW_IGNORED_TOO) && + (dir->flags & DIR_SHOW_IGNORED_TOO_MODE_MATCHING)) { + + /* + * This is an excluded directory and we are + * showing ignored paths that match an exclude + * pattern. (e.g. show directory as ignored + * only if it matches an exclude pattern). + * This path will either be 'path_excluded` + * (if we are showing empty directories or if + * the directory is not empty), or will be + * 'path_none' (empty directory, and we are + * not showing empty directories). + */ + if (!(dir->flags & DIR_HIDE_EMPTY_DIRECTORIES)) + return path_excluded; + + if (read_directory_recursive(dir, istate, dirname, len, + untracked, 1, 1, pathspec) == path_excluded) + return path_excluded; + + return path_none; + } if (!(dir->flags & DIR_NO_GITLINKS)) { - unsigned char sha1[20]; - if (resolve_gitlink_ref(dirname, "HEAD", sha1) == 0) - return path_untracked; + struct object_id oid; + if (resolve_gitlink_ref(dirname, "HEAD", &oid) == 0) + return exclude ? path_excluded : path_untracked; } return path_recurse; }