treewide: rename 'struct exclude_list' to 'struct pattern_list'
The first consumer of pattern-matching filenames was the .gitignore feature. In that context, storing a list of patterns as a 'struct exclude_list' makes sense. However, the sparse-checkout feature then adopted these structures and methods, but with the opposite meaning: these patterns match the files that should be included! It would be clearer to rename this entire library as a "pattern matching" library, and the callers apply exclusion/inclusion logic accordingly based on their needs. This commit renames 'struct exclude_list' to 'struct pattern_list' and renames several variables called 'el' to 'pl'. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee committed
Sep 3, 2019 at 11:04 UTC
caa3d5544474a6ef8e8d7db5c073c1564b76d8bb
8 files changed
+100
-100
builtin/check-ignore.c
+2
-2
@@ -41,7 +41,7 @@ static void output_pattern(const char *path, struct path_pattern *pattern)
41
write_name_quoted(path, stdout, '\n');
42
} else {
43
if (pattern) {
44
- quote_c_style(pattern->el->src, NULL, stdout, 0);
44
+ quote_c_style(pattern->pl->src, NULL, stdout, 0);
45
printf(":%d:%s%s%s\t",
46
pattern->srcpos,
47
bang, pattern->pattern, slash);
@@ -58,7 +58,7 @@ static void output_pattern(const char *path, struct path_pattern *pattern)
58
} else {
59
if (pattern)
60
printf("%s%c%d%c%s%s%s%c%s%c",
61
- pattern->el->src, '\0',
61
+ pattern->pl->src, '\0',
62
pattern->srcpos, '\0',
63
bang, pattern->pattern, slash, '\0',
64
path, '\0');
builtin/clean.c
+6
-6
@@ -647,7 +647,7 @@ static int filter_by_patterns_cmd(void)
647
struct strbuf confirm = STRBUF_INIT;
648
struct strbuf **ignore_list;
649
struct string_list_item *item;
650
- struct exclude_list *el;
650
+ struct pattern_list *pl;
651
int changed = -1, i;
652
653
for (;;) {
@@ -670,7 +670,7 @@ static int filter_by_patterns_cmd(void)
670
break;
671
672
memset(&dir, 0, sizeof(dir));
673
- el = add_exclude_list(&dir, EXC_CMDL, "manual exclude");
673
+ pl = add_exclude_list(&dir, EXC_CMDL, "manual exclude");
674
ignore_list = strbuf_split_max(&confirm, ' ', 0);
675
676
for (i = 0; ignore_list[i]; i++) {
@@ -678,7 +678,7 @@ static int filter_by_patterns_cmd(void)
678
if (!ignore_list[i]->len)
679
continue;
680
681
- add_exclude(ignore_list[i]->buf, "", 0, el, -(i+1));
681
+ add_exclude(ignore_list[i]->buf, "", 0, pl, -(i+1));
682
}
683
684
changed = 0;
@@ -900,7 +900,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
900
struct pathspec pathspec;
901
struct strbuf buf = STRBUF_INIT;
902
struct string_list exclude_list = STRING_LIST_INIT_NODUP;
903
- struct exclude_list *el;
903
+ struct pattern_list *pl;
904
struct string_list_item *item;
905
const char *qname;
906
struct option options[] = {
@@ -957,9 +957,9 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
957
if (!ignored)
958
setup_standard_excludes(&dir);
959
960
- el = add_exclude_list(&dir, EXC_CMDL, "--exclude option");
960
+ pl = add_exclude_list(&dir, EXC_CMDL, "--exclude option");
961
for (i = 0; i < exclude_list.nr; i++)
962
- add_exclude(exclude_list.items[i].string, "", 0, el, -(i+1));
962
+ add_exclude(exclude_list.items[i].string, "", 0, pl, -(i+1));
963
964
parse_pathspec(&pathspec, 0,
965
PATHSPEC_PREFER_CWD,
builtin/ls-files.c
+3
-3
@@ -516,7 +516,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
516
int require_work_tree = 0, show_tag = 0, i;
517
const char *max_prefix;
518
struct dir_struct dir;
519
- struct exclude_list *el;
519
+ struct pattern_list *pl;
520
struct string_list exclude_list = STRING_LIST_INIT_NODUP;
521
struct option builtin_ls_files_options[] = {
522
/* Think twice before adding "--nul" synonym to this */
@@ -594,9 +594,9 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
594
595
argc = parse_options(argc, argv, prefix, builtin_ls_files_options,
596
ls_files_usage, 0);
597
- el = add_exclude_list(&dir, EXC_CMDL, "--exclude option");
597
+ pl = add_exclude_list(&dir, EXC_CMDL, "--exclude option");
598
for (i = 0; i < exclude_list.nr; i++) {
599
- add_exclude(exclude_list.items[i].string, "", 0, el, --exclude_args);
599
+ add_exclude(exclude_list.items[i].string, "", 0, pl, --exclude_args);
600
}
601
if (show_tag || show_valid_bit || show_fsmonitor_bit) {
602
tag_cached = "H ";
dir.c
+53
-53
@@ -600,7 +600,7 @@ void parse_exclude_pattern(const char **pattern,
600
}
601
602
void add_exclude(const char *string, const char *base,
603
- int baselen, struct exclude_list *el, int srcpos)
603
+ int baselen, struct pattern_list *pl, int srcpos)
604
{
605
struct path_pattern *pattern;
606
int patternlen;
@@ -620,9 +620,9 @@ void add_exclude(const char *string, const char *base,
620
pattern->baselen = baselen;
621
pattern->flags = flags;
622
pattern->srcpos = srcpos;
623
- ALLOC_GROW(el->patterns, el->nr + 1, el->alloc);
624
- el->patterns[el->nr++] = pattern;
625
- pattern->el = el;
623
+ ALLOC_GROW(pl->patterns, pl->nr + 1, pl->alloc);
624
+ pl->patterns[pl->nr++] = pattern;
625
+ pattern->pl = pl;
626
}
627
628
static int read_skip_worktree_file_from_index(const struct index_state *istate,
@@ -643,19 +643,19 @@ static int read_skip_worktree_file_from_index(const struct index_state *istate,
643
}
644
645
/*
646
- * Frees memory within el which was allocated for exclude patterns and
647
- * the file buffer. Does not free el itself.
646
+ * Frees memory within pl which was allocated for exclude patterns and
647
+ * the file buffer. Does not free pl itself.
648
*/
649
-void clear_exclude_list(struct exclude_list *el)
649
+void clear_exclude_list(struct pattern_list *pl)
650
{
651
int i;
652
653
- for (i = 0; i < el->nr; i++)
654
- free(el->patterns[i]);
655
- free(el->patterns);
656
- free(el->filebuf);
653
+ for (i = 0; i < pl->nr; i++)
654
+ free(pl->patterns[i]);
655
+ free(pl->patterns);
656
+ free(pl->filebuf);
657
658
- memset(el, 0, sizeof(*el));
658
+ memset(pl, 0, sizeof(*pl));
659
}
660
661
static void trim_trailing_spaces(char *buf)
@@ -764,19 +764,19 @@ static void invalidate_directory(struct untracked_cache *uc,
764
765
static int add_excludes_from_buffer(char *buf, size_t size,
766
const char *base, int baselen,
767
- struct exclude_list *el);
767
+ struct pattern_list *pl);
768
769
/*
770
* Given a file with name "fname", read it (either from disk, or from
771
* an index if 'istate' is non-null), parse it and store the
772
- * exclude rules in "el".
772
+ * exclude rules in "pl".
773
*
774
* If "ss" is not NULL, compute SHA-1 of the exclude file and fill
775
* stat data from disk (only valid if add_excludes returns zero). If
776
* ss_valid is non-zero, "ss" must contain good value as input.
777
*/
778
static int add_excludes(const char *fname, const char *base, int baselen,
779
- struct exclude_list *el, struct index_state *istate,
779
+ struct pattern_list *pl, struct index_state *istate,
780
struct oid_stat *oid_stat)
781
{
782
struct stat st;
@@ -837,21 +837,21 @@ static int add_excludes(const char *fname, const char *base, int baselen,
837
}
838
}
839
840
- add_excludes_from_buffer(buf, size, base, baselen, el);
840
+ add_excludes_from_buffer(buf, size, base, baselen, pl);
841
return 0;
842
}
843
844
static int add_excludes_from_buffer(char *buf, size_t size,
845
const char *base, int baselen,
846
- struct exclude_list *el)
846
+ struct pattern_list *pl)
847
{
848
int i, lineno = 1;
849
char *entry;
850
851
- el->filebuf = buf;
851
+ pl->filebuf = buf;
852
853
if (skip_utf8_bom(&buf, size))
854
- size -= buf - el->filebuf;
854
+ size -= buf - pl->filebuf;
855
856
entry = buf;
857
@@ -860,7 +860,7 @@ static int add_excludes_from_buffer(char *buf, size_t size,
860
if (entry != buf + i && entry[0] != '#') {
861
buf[i - (i && buf[i-1] == '\r')] = 0;
862
trim_trailing_spaces(entry);
863
- add_exclude(entry, base, baselen, el, lineno);
863
+ add_exclude(entry, base, baselen, pl, lineno);
864
}
865
lineno++;
866
entry = buf + i + 1;
@@ -870,16 +870,16 @@ static int add_excludes_from_buffer(char *buf, size_t size,
870
}
871
872
int add_excludes_from_file_to_list(const char *fname, const char *base,
873
- int baselen, struct exclude_list *el,
873
+ int baselen, struct pattern_list *pl,
874
struct index_state *istate)
875
{
876
- return add_excludes(fname, base, baselen, el, istate, NULL);
876
+ return add_excludes(fname, base, baselen, pl, istate, NULL);
877
}
878
879
int add_excludes_from_blob_to_list(
880
struct object_id *oid,
881
const char *base, int baselen,
882
- struct exclude_list *el)
882
+ struct pattern_list *pl)
883
{
884
char *buf;
885
size_t size;
@@ -889,22 +889,22 @@ int add_excludes_from_blob_to_list(
889
if (r != 1)
890
return r;
891
892
- add_excludes_from_buffer(buf, size, base, baselen, el);
892
+ add_excludes_from_buffer(buf, size, base, baselen, pl);
893
return 0;
894
}
895
896
-struct exclude_list *add_exclude_list(struct dir_struct *dir,
896
+struct pattern_list *add_exclude_list(struct dir_struct *dir,
897
int group_type, const char *src)
898
{
899
- struct exclude_list *el;
899
+ struct pattern_list *pl;
900
struct exclude_list_group *group;
901
902
group = &dir->exclude_list_group[group_type];
903
- ALLOC_GROW(group->el, group->nr + 1, group->alloc);
904
- el = &group->el[group->nr++];
905
- memset(el, 0, sizeof(*el));
906
- el->src = src;
907
- return el;
903
+ ALLOC_GROW(group->pl, group->nr + 1, group->alloc);
904
+ pl = &group->pl[group->nr++];
905
+ memset(pl, 0, sizeof(*pl));
906
+ pl->src = src;
907
+ return pl;
908
}
909
910
/*
@@ -913,7 +913,7 @@ struct exclude_list *add_exclude_list(struct dir_struct *dir,
913
static void add_excludes_from_file_1(struct dir_struct *dir, const char *fname,
914
struct oid_stat *oid_stat)
915
{
916
- struct exclude_list *el;
916
+ struct pattern_list *pl;
917
/*
918
* catch setup_standard_excludes() that's called before
919
* dir->untracked is assigned. That function behaves
@@ -921,8 +921,8 @@ static void add_excludes_from_file_1(struct dir_struct *dir, const char *fname,
921
*/
922
if (!dir->untracked)
923
dir->unmanaged_exclude_files++;
924
- el = add_exclude_list(dir, EXC_FILE, fname);
925
- if (add_excludes(fname, "", 0, el, NULL, oid_stat) < 0)
924
+ pl = add_exclude_list(dir, EXC_FILE, fname);
925
+ if (add_excludes(fname, "", 0, pl, NULL, oid_stat) < 0)
926
die(_("cannot use %s as an exclude file"), fname);
927
}
928
@@ -1025,17 +1025,17 @@ static struct path_pattern *last_exclude_matching_from_list(const char *pathname
1025
int pathlen,
1026
const char *basename,
1027
int *dtype,
1028
- struct exclude_list *el,
1028
+ struct pattern_list *pl,
1029
struct index_state *istate)
1030
{
1031
struct path_pattern *res = NULL; /* undecided */
1032
int i;
1033
1034
- if (!el->nr)
1034
+ if (!pl->nr)
1035
return NULL; /* undefined */
1036
1037
- for (i = el->nr - 1; 0 <= i; i--) {
1038
- struct path_pattern *pattern = el->patterns[i];
1037
+ for (i = pl->nr - 1; 0 <= i; i--) {
1038
+ struct path_pattern *pattern = pl->patterns[i];
1039
const char *exclude = pattern->pattern;
1040
int prefix = pattern->nowildcardlen;
1041
@@ -1077,11 +1077,11 @@ static struct path_pattern *last_exclude_matching_from_list(const char *pathname
1077
*/
1078
int is_excluded_from_list(const char *pathname,
1079
int pathlen, const char *basename, int *dtype,
1080
- struct exclude_list *el, struct index_state *istate)
1080
+ struct pattern_list *pl, struct index_state *istate)
1081
{
1082
struct path_pattern *pattern;
1083
pattern = last_exclude_matching_from_list(pathname, pathlen, basename,
1084
- dtype, el, istate);
1084
+ dtype, pl, istate);
1085
if (pattern)
1086
return pattern->flags & EXC_FLAG_NEGATIVE ? 0 : 1;
1087
return -1; /* undecided */
@@ -1100,7 +1100,7 @@ static struct path_pattern *last_exclude_matching_from_lists(
1100
for (j = group->nr - 1; j >= 0; j--) {
1101
pattern = last_exclude_matching_from_list(
1102
pathname, pathlen, basename, dtype_p,
1103
- &group->el[j], istate);
1103
+ &group->pl[j], istate);
1104
if (pattern)
1105
return pattern;
1106
}
@@ -1117,7 +1117,7 @@ static void prep_exclude(struct dir_struct *dir,
1117
const char *base, int baselen)
1118
{
1119
struct exclude_list_group *group;
1120
- struct exclude_list *el;
1120
+ struct pattern_list *pl;
1121
struct exclude_stack *stk = NULL;
1122
struct untracked_cache_dir *untracked;
1123
int current;
@@ -1133,11 +1133,11 @@ static void prep_exclude(struct dir_struct *dir,
1133
if (stk->baselen <= baselen &&
1134
!strncmp(dir->basebuf.buf, base, stk->baselen))
1135
break;
1136
- el = &group->el[dir->exclude_stack->exclude_ix];
1136
+ pl = &group->pl[dir->exclude_stack->exclude_ix];
1137
dir->exclude_stack = stk->prev;
1138
dir->pattern = NULL;
1139
- free((char *)el->src); /* see strbuf_detach() below */
1140
- clear_exclude_list(el);
1139
+ free((char *)pl->src); /* see strbuf_detach() below */
1140
+ clear_exclude_list(pl);
1141
free(stk);
1142
group->nr--;
1143
}
@@ -1184,7 +1184,7 @@ static void prep_exclude(struct dir_struct *dir,
1184
stk->baselen = cp - base;
1185
stk->exclude_ix = group->nr;
1186
stk->ucd = untracked;
1187
- el = add_exclude_list(dir, EXC_DIRS, NULL);
1187
+ pl = add_exclude_list(dir, EXC_DIRS, NULL);
1188
strbuf_add(&dir->basebuf, base + current, stk->baselen - current);
1189
assert(stk->baselen == dir->basebuf.len);
1190
@@ -1234,8 +1234,8 @@ static void prep_exclude(struct dir_struct *dir,
1234
struct strbuf sb = STRBUF_INIT;
1235
strbuf_addbuf(&sb, &dir->basebuf);
1236
strbuf_addstr(&sb, dir->exclude_per_dir);
1237
- el->src = strbuf_detach(&sb, NULL);
1238
- add_excludes(el->src, el->src, stk->baselen, el, istate,
1237
+ pl->src = strbuf_detach(&sb, NULL);
1238
+ add_excludes(pl->src, pl->src, stk->baselen, pl, istate,
1239
untracked ? &oid_stat : NULL);
1240
}
1241
/*
@@ -2530,18 +2530,18 @@ void clear_directory(struct dir_struct *dir)
2530
{
2531
int i, j;
2532
struct exclude_list_group *group;
2533
- struct exclude_list *el;
2533
+ struct pattern_list *pl;
2534
struct exclude_stack *stk;
2535
2536
for (i = EXC_CMDL; i <= EXC_FILE; i++) {
2537
group = &dir->exclude_list_group[i];
2538
for (j = 0; j < group->nr; j++) {
2539
- el = &group->el[j];
2539
+ pl = &group->pl[j];
2540
if (i == EXC_DIRS)
2541
- free((char *)el->src);
2542
- clear_exclude_list(el);
2541
+ free((char *)pl->src);
2542
+ clear_exclude_list(pl);
2543
}
2544
- free(group->el);
2544
+ free(group->pl);
2545
}
2546
2547
stk = dir->exclude_stack;
dir.h
+9
-9
@@ -21,7 +21,7 @@ struct path_pattern {
21
* This allows callers of last_exclude_matching() etc.
22
* to determine the origin of the matching pattern.
23
*/
24
- struct exclude_list *el;
24
+ struct pattern_list *pl;
25
26
const char *pattern;
27
int patternlen;
@@ -44,7 +44,7 @@ struct path_pattern {
44
* can also be used to represent the list of --exclude values passed
45
* via CLI args.
46
*/
47
-struct exclude_list {
47
+struct pattern_list {
48
int nr;
49
int alloc;
50
@@ -72,7 +72,7 @@ struct exclude_stack {
72
73
struct exclude_list_group {
74
int nr, alloc;
75
- struct exclude_list *el;
75
+ struct pattern_list *pl;
76
};
77
78
struct oid_stat {
@@ -232,7 +232,7 @@ int read_directory(struct dir_struct *, struct index_state *istate,
232
233
int is_excluded_from_list(const char *pathname, int pathlen,
234
const char *basename, int *dtype,
235
- struct exclude_list *el,
235
+ struct pattern_list *pl,
236
struct index_state *istate);
237
struct dir_entry *dir_add_ignored(struct dir_struct *dir,
238
struct index_state *istate,
@@ -256,18 +256,18 @@ int is_excluded(struct dir_struct *dir,
256
struct index_state *istate,
257
const char *name, int *dtype);
258
259
-struct exclude_list *add_exclude_list(struct dir_struct *dir,
259
+struct pattern_list *add_exclude_list(struct dir_struct *dir,
260
int group_type, const char *src);
261
int add_excludes_from_file_to_list(const char *fname, const char *base, int baselen,
262
- struct exclude_list *el, struct index_state *istate);
262
+ struct pattern_list *pl, struct index_state *istate);
263
void add_excludes_from_file(struct dir_struct *, const char *fname);
264
int add_excludes_from_blob_to_list(struct object_id *oid,
265
const char *base, int baselen,
266
- struct exclude_list *el);
266
+ struct pattern_list *pl);
267
void parse_exclude_pattern(const char **string, int *patternlen, unsigned *flags, int *nowildcardlen);
268
void add_exclude(const char *string, const char *base,
269
- int baselen, struct exclude_list *el, int srcpos);
270
-void clear_exclude_list(struct exclude_list *el);
269
+ int baselen, struct pattern_list *pl, int srcpos);
270
+void clear_exclude_list(struct pattern_list *pl);
271
void clear_directory(struct dir_struct *dir);
272
273
int repo_file_exists(struct repository *repo, const char *path);
list-objects-filter.c
+4
-4
@@ -347,7 +347,7 @@ struct frame {
347
};
348
349
struct filter_sparse_data {
350
- struct exclude_list el;
350
+ struct pattern_list pl;
351
352
size_t nr, alloc;
353
struct frame *array_frame;
@@ -374,7 +374,7 @@ static enum list_objects_filter_result filter_sparse(
374
assert(obj->type == OBJ_TREE);
375
dtype = DT_DIR;
376
val = is_excluded_from_list(pathname, strlen(pathname),
377
- filename, &dtype, &filter_data->el,
377
+ filename, &dtype, &filter_data->pl,
378
r->index);
379
if (val < 0)
380
val = filter_data->array_frame[filter_data->nr - 1].defval;
@@ -436,7 +436,7 @@ static enum list_objects_filter_result filter_sparse(
436
437
dtype = DT_REG;
438
val = is_excluded_from_list(pathname, strlen(pathname),
439
- filename, &dtype, &filter_data->el,
439
+ filename, &dtype, &filter_data->pl,
440
r->index);
441
if (val < 0)
442
val = frame->defval;
@@ -483,7 +483,7 @@ static void filter_sparse_oid__init(
483
{
484
struct filter_sparse_data *d = xcalloc(1, sizeof(*d));
485
if (add_excludes_from_blob_to_list(filter_options->sparse_oid_value,
486
- NULL, 0, &d->el) < 0)
486
+ NULL, 0, &d->pl) < 0)
487
die("could not load filter specification");
488
489
ALLOC_GROW(d->array_frame, d->nr + 1, d->alloc);
unpack-trees.c
+21
-21
@@ -1265,7 +1265,7 @@ static int clear_ce_flags_1(struct index_state *istate,
1265
struct cache_entry **cache, int nr,
1266
struct strbuf *prefix,
1267
int select_mask, int clear_mask,
1268
- struct exclude_list *el, int defval);
1268
+ struct pattern_list *pl, int defval);
1269
1270
/* Whole directory matching */
1271
static int clear_ce_flags_dir(struct index_state *istate,
@@ -1273,12 +1273,12 @@ static int clear_ce_flags_dir(struct index_state *istate,
1273
struct strbuf *prefix,
1274
char *basename,
1275
int select_mask, int clear_mask,
1276
- struct exclude_list *el, int defval)
1276
+ struct pattern_list *pl, int defval)
1277
{
1278
struct cache_entry **cache_end;
1279
int dtype = DT_DIR;
1280
int ret = is_excluded_from_list(prefix->buf, prefix->len,
1281
- basename, &dtype, el, istate);
1281
+ basename, &dtype, pl, istate);
1282
int rc;
1283
1284
strbuf_addch(prefix, '/');
@@ -1294,7 +1294,7 @@ static int clear_ce_flags_dir(struct index_state *istate,
1294
}
1295
1296
/*
1297
- * TODO: check el, if there are no patterns that may conflict
1297
+ * TODO: check pl, if there are no patterns that may conflict
1298
* with ret (iow, we know in advance the incl/excl
1299
* decision for the entire directory), clear flag here without
1300
* calling clear_ce_flags_1(). That function will call
@@ -1303,14 +1303,14 @@ static int clear_ce_flags_dir(struct index_state *istate,
1303
rc = clear_ce_flags_1(istate, cache, cache_end - cache,
1304
prefix,
1305
select_mask, clear_mask,
1306
- el, ret);
1306
+ pl, ret);
1307
strbuf_setlen(prefix, prefix->len - 1);
1308
return rc;
1309
}
1310
1311
/*
1312
* Traverse the index, find every entry that matches according to
1313
- * o->el. Do "ce_flags &= ~clear_mask" on those entries. Return the
1313
+ * o->pl. Do "ce_flags &= ~clear_mask" on those entries. Return the
1314
* number of traversed entries.
1315
*
1316
* If select_mask is non-zero, only entries whose ce_flags has on of
@@ -1327,7 +1327,7 @@ static int clear_ce_flags_1(struct index_state *istate,
1327
struct cache_entry **cache, int nr,
1328
struct strbuf *prefix,
1329
int select_mask, int clear_mask,
1330
- struct exclude_list *el, int defval)
1330
+ struct pattern_list *pl, int defval)
1331
{
1332
struct cache_entry **cache_end = cache + nr;
1333
@@ -1362,7 +1362,7 @@ static int clear_ce_flags_1(struct index_state *istate,
1362
prefix,
1363
prefix->buf + prefix->len - len,
1364
select_mask, clear_mask,
1365
- el, defval);
1365
+ pl, defval);
1366
1367
/* clear_c_f_dir eats a whole dir already? */
1368
if (processed) {
@@ -1374,7 +1374,7 @@ static int clear_ce_flags_1(struct index_state *istate,
1374
strbuf_addch(prefix, '/');
1375
cache += clear_ce_flags_1(istate, cache, cache_end - cache,
1376
prefix,
1377
- select_mask, clear_mask, el, defval);
1377
+ select_mask, clear_mask, pl, defval);
1378
strbuf_setlen(prefix, prefix->len - len - 1);
1379
continue;
1380
}
@@ -1382,7 +1382,7 @@ static int clear_ce_flags_1(struct index_state *istate,
1382
/* Non-directory */
1383
dtype = ce_to_dtype(ce);
1384
ret = is_excluded_from_list(ce->name, ce_namelen(ce),
1385
- name, &dtype, el, istate);
1385
+ name, &dtype, pl, istate);
1386
if (ret < 0)
1387
ret = defval;
1388
if (ret > 0)
@@ -1394,7 +1394,7 @@ static int clear_ce_flags_1(struct index_state *istate,
1394
1395
static int clear_ce_flags(struct index_state *istate,
1396
int select_mask, int clear_mask,
1397
- struct exclude_list *el)
1397
+ struct pattern_list *pl)
1398
{
1399
static struct strbuf prefix = STRBUF_INIT;
1400
@@ -1405,13 +1405,13 @@ static int clear_ce_flags(struct index_state *istate,
1405
istate->cache_nr,
1406
&prefix,
1407
select_mask, clear_mask,
1408
- el, 0);
1408
+ pl, 0);
1409
}
1410
1411
/*
1412
* Set/Clear CE_NEW_SKIP_WORKTREE according to $GIT_DIR/info/sparse-checkout
1413
*/
1414
-static void mark_new_skip_worktree(struct exclude_list *el,
1414
+static void mark_new_skip_worktree(struct pattern_list *pl,
1415
struct index_state *istate,
1416
int select_flag, int skip_wt_flag)
1417
{
@@ -1437,7 +1437,7 @@ static void mark_new_skip_worktree(struct exclude_list *el,
1437
* 2. Widen worktree according to sparse-checkout file.
1438
* Matched entries will have skip_wt_flag cleared (i.e. "in")
1439
*/
1440
- clear_ce_flags(istate, select_flag, skip_wt_flag, el);
1440
+ clear_ce_flags(istate, select_flag, skip_wt_flag, pl);
1441
}
1442
1443
static int verify_absent(const struct cache_entry *,
@@ -1453,21 +1453,21 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
1453
{
1454
int i, ret;
1455
static struct cache_entry *dfc;
1456
- struct exclude_list el;
1456
+ struct pattern_list pl;
1457
1458
if (len > MAX_UNPACK_TREES)
1459
die("unpack_trees takes at most %d trees", MAX_UNPACK_TREES);
1460
1461
trace_performance_enter();
1462
- memset(&el, 0, sizeof(el));
1462
+ memset(&pl, 0, sizeof(pl));
1463
if (!core_apply_sparse_checkout || !o->update)
1464
o->skip_sparse_checkout = 1;
1465
if (!o->skip_sparse_checkout) {
1466
char *sparse = git_pathdup("info/sparse-checkout");
1467
- if (add_excludes_from_file_to_list(sparse, "", 0, &el, NULL) < 0)
1467
+ if (add_excludes_from_file_to_list(sparse, "", 0, &pl, NULL) < 0)
1468
o->skip_sparse_checkout = 1;
1469
else
1470
- o->el = ⪙
1470
+ o->pl = &pl;
1471
free(sparse);
1472
}
1473
@@ -1498,7 +1498,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
1498
* Sparse checkout loop #1: set NEW_SKIP_WORKTREE on existing entries
1499
*/
1500
if (!o->skip_sparse_checkout)
1501
- mark_new_skip_worktree(o->el, o->src_index, 0, CE_NEW_SKIP_WORKTREE);
1501
+ mark_new_skip_worktree(o->pl, o->src_index, 0, CE_NEW_SKIP_WORKTREE);
1502
1503
if (!dfc)
1504
dfc = xcalloc(1, cache_entry_size(0));
@@ -1563,7 +1563,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
1563
* If the will have NEW_SKIP_WORKTREE, also set CE_SKIP_WORKTREE
1564
* so apply_sparse_checkout() won't attempt to remove it from worktree
1565
*/
1566
- mark_new_skip_worktree(o->el, &o->result, CE_ADDED, CE_SKIP_WORKTREE | CE_NEW_SKIP_WORKTREE);
1566
+ mark_new_skip_worktree(o->pl, &o->result, CE_ADDED, CE_SKIP_WORKTREE | CE_NEW_SKIP_WORKTREE);
1567
1568
ret = 0;
1569
for (i = 0; i < o->result.cache_nr; i++) {
@@ -1631,7 +1631,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
1631
1632
done:
1633
trace_performance_leave("unpack_trees");
1634
- clear_exclude_list(&el);
1634
+ clear_exclude_list(&pl);
1635
return ret;
1636
1637
return_failed:
unpack-trees.h
+2
-2
@@ -10,7 +10,7 @@
10
11
struct cache_entry;
12
struct unpack_trees_options;
13
-struct exclude_list;
13
+struct pattern_list;
14
15
typedef int (*merge_fn_t)(const struct cache_entry * const *src,
16
struct unpack_trees_options *options);
@@ -83,7 +83,7 @@ struct unpack_trees_options {
83
struct index_state *src_index;
84
struct index_state result;
85
86
- struct exclude_list *el; /* for internal use */
86
+ struct pattern_list *pl; /* for internal use */
87
};
88
89
int unpack_trees(unsigned n, struct tree_desc *t,