1092
return mask;
1093
}
1094
1095
-static int clear_ce_flags_1(struct cache_entry **cache, int nr,
1095
+static int clear_ce_flags_1(struct index_state *istate,
1096
+ struct cache_entry **cache, int nr,
1097
struct strbuf *prefix,
1098
int select_mask, int clear_mask,
1099
struct exclude_list *el, int defval);
1100
1101
/* Whole directory matching */
1101
-static int clear_ce_flags_dir(struct cache_entry **cache, int nr,
1102
+static int clear_ce_flags_dir(struct index_state *istate,
1103
+ struct cache_entry **cache, int nr,
1104
struct strbuf *prefix,
1105
char *basename,
1106
int select_mask, int clear_mask,
1109
struct cache_entry **cache_end;
1110
int dtype = DT_DIR;
1111
int ret = is_excluded_from_list(prefix->buf, prefix->len,
1110
- basename, &dtype, el, &the_index);
1112
+ basename, &dtype, el, istate);
1113
int rc;
1114
1115
strbuf_addch(prefix, '/');
1131
* calling clear_ce_flags_1(). That function will call
1132
* the expensive is_excluded_from_list() on every entry.
1133
*/
1132
- rc = clear_ce_flags_1(cache, cache_end - cache,
1134
+ rc = clear_ce_flags_1(istate, cache, cache_end - cache,
1135
prefix,
1136
select_mask, clear_mask,
1137
el, ret);
1154
* cache[0]->name[0..(prefix_len-1)]
1155
* Top level path has prefix_len zero.
1156
*/
1155
-static int clear_ce_flags_1(struct cache_entry **cache, int nr,
1157
+static int clear_ce_flags_1(struct index_state *istate,
1158
+ struct cache_entry **cache, int nr,
1159
struct strbuf *prefix,
1160
int select_mask, int clear_mask,
1161
struct exclude_list *el, int defval)
1189
len = slash - name;
1190
strbuf_add(prefix, name, len);
1191
1189
- processed = clear_ce_flags_dir(cache, cache_end - cache,
1192
+ processed = clear_ce_flags_dir(istate, cache, cache_end - cache,
1193
prefix,
1194
prefix->buf + prefix->len - len,
1195
select_mask, clear_mask,
1203
}
1204
1205
strbuf_addch(prefix, '/');
1203
- cache += clear_ce_flags_1(cache, cache_end - cache,
1206
+ cache += clear_ce_flags_1(istate, cache, cache_end - cache,
1207
prefix,
1208
select_mask, clear_mask, el, defval);
1209
strbuf_setlen(prefix, prefix->len - len - 1);
1213
/* Non-directory */
1214
dtype = ce_to_dtype(ce);
1215
ret = is_excluded_from_list(ce->name, ce_namelen(ce),
1213
- name, &dtype, el, &the_index);
1216
+ name, &dtype, el, istate);
1217
if (ret < 0)
1218
ret = defval;
1219
if (ret > 0)
1223
return nr - (cache_end - cache);
1224
}
1225
1223
-static int clear_ce_flags(struct cache_entry **cache, int nr,
1224
- int select_mask, int clear_mask,
1225
- struct exclude_list *el)
1226
+static int clear_ce_flags(struct index_state *istate,
1227
+ int select_mask, int clear_mask,
1228
+ struct exclude_list *el)
1229
{
1230
static struct strbuf prefix = STRBUF_INIT;
1231
1232
strbuf_reset(&prefix);
1233
1231
- return clear_ce_flags_1(cache, nr,
1234
+ return clear_ce_flags_1(istate,
1235
+ istate->cache,
1236
+ istate->cache_nr,
1237
&prefix,
1238
select_mask, clear_mask,
1239
el, 0);
1268
* 2. Widen worktree according to sparse-checkout file.
1269
* Matched entries will have skip_wt_flag cleared (i.e. "in")
1270
*/
1266
- clear_ce_flags(istate->cache, istate->cache_nr, select_flag, skip_wt_flag, el);
1271
+ clear_ce_flags(istate, select_flag, skip_wt_flag, el);
1272
}
1273
1274
static int verify_absent(const struct cache_entry *,