Skip to content

Commit fba92be

Browse files
bmwillgitster
authored andcommitted
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>
1 parent 2b70e88 commit fba92be

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

dir.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,10 +1010,11 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
10101010
*/
10111011
int is_excluded_from_list(const char *pathname,
10121012
int pathlen, const char *basename, int *dtype,
1013-
struct exclude_list *el)
1013+
struct exclude_list *el, struct index_state *istate)
10141014
{
10151015
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);
10171018
if (exclude)
10181019
return exclude->flags & EXC_FLAG_NEGATIVE ? 0 : 1;
10191020
return -1; /* undecided */

dir.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,10 @@ extern int within_depth(const char *name, int namelen, int depth, int max_depth)
217217
extern int fill_directory(struct dir_struct *dir, const struct pathspec *pathspec);
218218
extern int read_directory(struct dir_struct *, const char *path, int len, const struct pathspec *pathspec);
219219

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);
222224
struct dir_entry *dir_add_ignored(struct dir_struct *dir,
223225
struct index_state *istate,
224226
const char *pathname, int len);

unpack-trees.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ static int clear_ce_flags_dir(struct cache_entry **cache, int nr,
10681068
struct cache_entry **cache_end;
10691069
int dtype = DT_DIR;
10701070
int ret = is_excluded_from_list(prefix->buf, prefix->len,
1071-
basename, &dtype, el);
1071+
basename, &dtype, el, &the_index);
10721072
int rc;
10731073

10741074
strbuf_addch(prefix, '/');
@@ -1171,7 +1171,7 @@ static int clear_ce_flags_1(struct cache_entry **cache, int nr,
11711171
/* Non-directory */
11721172
dtype = ce_to_dtype(ce);
11731173
ret = is_excluded_from_list(ce->name, ce_namelen(ce),
1174-
name, &dtype, el);
1174+
name, &dtype, el, &the_index);
11751175
if (ret < 0)
11761176
ret = defval;
11771177
if (ret > 0)

0 commit comments

Comments
 (0)