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 /unpack-trees.c | |
parent | 9d8d51d53b53e32bd2b642676f6f1798e2a0897b (diff) | |
parent | 0d316f0ceff1c416c25327f40bc5fbdded98a01a (diff) | |
download | git-1966babf6e8e5c67e2dec05aa00437246ded0497.tar.gz |
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 'unpack-trees.c')
-rw-r--r-- | unpack-trees.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/unpack-trees.c b/unpack-trees.c index ad40109432..33a581924e 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -1023,6 +1023,10 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options o->el = ⪙ } + if (o->dir) { + o->path_exclude_check = xmalloc(sizeof(struct path_exclude_check)); + path_exclude_check_init(o->path_exclude_check, o->dir); + } memset(&o->result, 0, sizeof(o->result)); o->result.initialized = 1; o->result.timestamp.sec = o->src_index->timestamp.sec; @@ -1148,6 +1152,10 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options done: free_excludes(&el); + if (o->path_exclude_check) { + path_exclude_check_clear(o->path_exclude_check); + free(o->path_exclude_check); + } return ret; return_failed: @@ -1363,7 +1371,8 @@ static int check_ok_to_remove(const char *name, int len, int dtype, if (ignore_case && icase_exists(o, name, len, st)) return 0; - if (o->dir && excluded(o->dir, name, &dtype)) + if (o->dir && + path_excluded(o->path_exclude_check, name, -1, &dtype)) /* * ce->name is explicitly excluded, so it is Ok to * overwrite it. |