diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-06-21 14:42:06 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-06-21 14:42:07 -0700 |
commit | 1966babf6e8e5c67e2dec05aa00437246ded0497 (patch) | |
tree | 6a97fe99a8753d71c56157ed160982393bc19b62 /builtin/add.c | |
parent | Merge branch 'jk/version-string' (diff) | |
parent | dir.c: make excluded() file scope static (diff) | |
download | tgif-1966babf6e8e5c67e2dec05aa00437246ded0497.tar.xz |
Merge branch 'jc/ls-files-i-dir'
"git ls-files --exclude=t -i" did not consider anything under t/
as excluded, as it did not pay attention to exclusion of leading
paths while walking the index. Other two users of excluded() are
also updated.
* jc/ls-files-i-dir:
dir.c: make excluded() file scope static
unpack-trees.c: use path_excluded() in check_ok_to_remove()
builtin/add.c: use path_excluded()
path_excluded(): update API to less cache-entry centric
ls-files -i: micro-optimize path_excluded()
ls-files -i: pay attention to exclusion of leading paths
Diffstat (limited to 'builtin/add.c')
-rw-r--r-- | builtin/add.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/add.c b/builtin/add.c index b79336d712..87446cf92a 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -443,6 +443,9 @@ 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_used_pathspec(pathspec); for (i = 0; pathspec[i]; i++) { @@ -450,7 +453,7 @@ int cmd_add(int argc, const char **argv, const char *prefix) && !file_exists(pathspec[i])) { if (ignore_missing) { int dtype = DT_UNKNOWN; - if (excluded(&dir, pathspec[i], &dtype)) + if (path_excluded(&check, pathspec[i], -1, &dtype)) dir_add_ignored(&dir, pathspec[i], strlen(pathspec[i])); } else die(_("pathspec '%s' did not match any files"), @@ -458,6 +461,7 @@ int cmd_add(int argc, const char **argv, const char *prefix) } } free(seen); + path_exclude_check_clear(&check); } plug_bulk_checkin(); |