Skip to content

Commit e799ed4

Browse files
bmwillgitster
authored andcommitted
dir: convert prep_exclude to take an index
Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 473e393 commit e799ed4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

dir.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,9 @@ static struct exclude *last_exclude_matching_from_lists(struct dir_struct *dir,
10461046
* Loads the per-directory exclude list for the substring of base
10471047
* which has a char length of baselen.
10481048
*/
1049-
static void prep_exclude(struct dir_struct *dir, const char *base, int baselen)
1049+
static void prep_exclude(struct dir_struct *dir,
1050+
struct index_state *istate,
1051+
const char *base, int baselen)
10501052
{
10511053
struct exclude_list_group *group;
10521054
struct exclude_list *el;
@@ -1125,7 +1127,7 @@ static void prep_exclude(struct dir_struct *dir, const char *base, int baselen)
11251127
int dt = DT_DIR;
11261128
dir->basebuf.buf[stk->baselen - 1] = 0;
11271129
dir->exclude = last_exclude_matching_from_lists(dir,
1128-
&the_index,
1130+
istate,
11291131
dir->basebuf.buf, stk->baselen - 1,
11301132
dir->basebuf.buf + current, &dt);
11311133
dir->basebuf.buf[stk->baselen - 1] = '/';
@@ -1167,7 +1169,7 @@ static void prep_exclude(struct dir_struct *dir, const char *base, int baselen)
11671169
strbuf_addbuf(&sb, &dir->basebuf);
11681170
strbuf_addstr(&sb, dir->exclude_per_dir);
11691171
el->src = strbuf_detach(&sb, NULL);
1170-
add_excludes(el->src, el->src, stk->baselen, el, &the_index,
1172+
add_excludes(el->src, el->src, stk->baselen, el, istate,
11711173
untracked ? &sha1_stat : NULL);
11721174
}
11731175
/*
@@ -1209,7 +1211,7 @@ struct exclude *last_exclude_matching(struct dir_struct *dir,
12091211
const char *basename = strrchr(pathname, '/');
12101212
basename = (basename) ? basename+1 : pathname;
12111213

1212-
prep_exclude(dir, pathname, basename-pathname);
1214+
prep_exclude(dir, &the_index, pathname, basename-pathname);
12131215

12141216
if (dir->exclude)
12151217
return dir->exclude;
@@ -1695,10 +1697,10 @@ static int valid_cached_dir(struct dir_struct *dir,
16951697
*/
16961698
if (path->len && path->buf[path->len - 1] != '/') {
16971699
strbuf_addch(path, '/');
1698-
prep_exclude(dir, path->buf, path->len);
1700+
prep_exclude(dir, &the_index, path->buf, path->len);
16991701
strbuf_setlen(path, path->len - 1);
17001702
} else
1701-
prep_exclude(dir, path->buf, path->len);
1703+
prep_exclude(dir, &the_index, path->buf, path->len);
17021704

17031705
/* hopefully prep_exclude() haven't invalidated this entry... */
17041706
return untracked->valid;

0 commit comments

Comments
 (0)