dir: convert is_excluded_from_list to take an index

Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Williams committed May 5, 2017 at 12:53 UTC fba92be8f73818c4e79dc0b93ba26733d0ba5efe
3 files changed +9 -6
dir.c
+3 -2
@@ -1010,10 +1010,11 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
1010 */
1011 int is_excluded_from_list(const char *pathname,
1012 int pathlen, const char *basename, int *dtype,
1013 - struct exclude_list *el)
1013 + struct exclude_list *el, struct index_state *istate)
1014 {
1015 struct exclude *exclude;
1016 - exclude = last_exclude_matching_from_list(pathname, pathlen, basename, dtype, el, &the_index);
1016 + exclude = last_exclude_matching_from_list(pathname, pathlen, basename,
1017 + dtype, el, istate);
1018 if (exclude)
1019 return exclude->flags & EXC_FLAG_NEGATIVE ? 0 : 1;
1020 return -1; /* undecided */
dir.h
+4 -2
@@ -217,8 +217,10 @@ extern int within_depth(const char *name, int namelen, int depth, int max_depth)
217 extern int fill_directory(struct dir_struct *dir, const struct pathspec *pathspec);
218 extern int read_directory(struct dir_struct *, const char *path, int len, const struct pathspec *pathspec);
219
220 -extern int is_excluded_from_list(const char *pathname, int pathlen, const char *basename,
221 - int *dtype, struct exclude_list *el);
220 +extern int is_excluded_from_list(const char *pathname, int pathlen,
221 + const char *basename, int *dtype,
222 + struct exclude_list *el,
223 + struct index_state *istate);
224 struct dir_entry *dir_add_ignored(struct dir_struct *dir,
225 struct index_state *istate,
226 const char *pathname, int len);
unpack-trees.c
+2 -2
@@ -1068,7 +1068,7 @@ static int clear_ce_flags_dir(struct cache_entry **cache, int nr,
1068 struct cache_entry **cache_end;
1069 int dtype = DT_DIR;
1070 int ret = is_excluded_from_list(prefix->buf, prefix->len,
1071 - basename, &dtype, el);
1071 + basename, &dtype, el, &the_index);
1072 int rc;
1073
1074 strbuf_addch(prefix, '/');
@@ -1171,7 +1171,7 @@ static int clear_ce_flags_1(struct cache_entry **cache, int nr,
1171 /* Non-directory */
1172 dtype = ce_to_dtype(ce);
1173 ret = is_excluded_from_list(ce->name, ce_namelen(ce),
1174 - name, &dtype, el);
1174 + name, &dtype, el, &the_index);
1175 if (ret < 0)
1176 ret = defval;
1177 if (ret > 0)