Merge branch 'kb/status-ignored-optim-2'
Fixes a handful of issues in the code to traverse working tree to find untracked and/or ignored files, cleans up and optimizes the codepath in general. * kb/status-ignored-optim-2: dir.c: git-status --ignored: don't scan the work tree twice dir.c: git-status --ignored: don't scan the work tree three times dir.c: git-status: avoid is_excluded checks for tracked files dir.c: replace is_path_excluded with now equivalent is_excluded API dir.c: unify is_excluded and is_path_excluded APIs dir.c: move prep_exclude dir.c: factor out parts of last_exclude_matching for later reuse dir.c: git-clean -d -X: don't delete tracked directories dir.c: make 'git-status --ignored' work within leading directories dir.c: git-status --ignored: don't list empty directories as ignored dir.c: git-ls-files --directories: don't hide empty directories dir.c: git-status --ignored: don't list empty ignored directories dir.c: git-status --ignored: don't list files in ignored directories dir.c: git-status --ignored: don't drop ignored directories
This commit is contained in:
@ -545,9 +545,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
|
||||
|
||||
if (pathspec) {
|
||||
int i;
|
||||
struct path_exclude_check check;
|
||||
|
||||
path_exclude_check_init(&check, &dir);
|
||||
if (!seen)
|
||||
seen = find_pathspecs_matching_against_index(pathspec);
|
||||
for (i = 0; pathspec[i]; i++) {
|
||||
@ -555,7 +553,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
|
||||
&& !file_exists(pathspec[i])) {
|
||||
if (ignore_missing) {
|
||||
int dtype = DT_UNKNOWN;
|
||||
if (is_path_excluded(&check, pathspec[i], -1, &dtype))
|
||||
if (is_excluded(&dir, pathspec[i], &dtype))
|
||||
dir_add_ignored(&dir, pathspec[i], strlen(pathspec[i]));
|
||||
} else
|
||||
die(_("pathspec '%s' did not match any files"),
|
||||
@ -563,7 +561,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)
|
||||
}
|
||||
}
|
||||
free(seen);
|
||||
path_exclude_check_clear(&check);
|
||||
}
|
||||
|
||||
plug_bulk_checkin();
|
||||
|
Reference in New Issue
Block a user