1 #include "git-compat-util.h"
5 #include "environment.h"
9 #include "read-cache.h"
10 #include "repository.h"
15 #include "wildmatch.h"
18 * Finds which of the given pathspecs match items in the index.
20 * For each pathspec, sets the corresponding entry in the seen[] array
21 * (which should be specs items long, i.e. the same size as pathspec)
22 * to the nature of the "closest" (i.e. most specific) match found for
23 * that pathspec in the index, if it was a closer type of match than
24 * the existing entry. As an optimization, matching is skipped
25 * altogether if seen[] already only contains non-zero entries.
27 * If seen[] has not already been written to, it may make sense
28 * to use find_pathspecs_matching_against_index() instead.
30 void add_pathspec_matches_against_index(const struct pathspec
*pathspec
,
31 struct index_state
*istate
,
33 enum ps_skip_worktree_action sw_action
)
35 int num_unmatched
= 0, i
;
38 * Since we are walking the index as if we were walking the directory,
39 * we have to mark the matched pathspec as seen; otherwise we will
40 * mistakenly think that the user gave a pathspec that did not match
43 for (i
= 0; i
< pathspec
->nr
; i
++)
48 for (i
= 0; i
< istate
->cache_nr
; i
++) {
49 const struct cache_entry
*ce
= istate
->cache
[i
];
50 if (sw_action
== PS_IGNORE_SKIP_WORKTREE
&&
51 (ce_skip_worktree(ce
) || !path_in_sparse_checkout(ce
->name
, istate
)))
53 ce_path_match(istate
, ce
, pathspec
, seen
);
58 * Finds which of the given pathspecs match items in the index.
60 * This is a one-shot wrapper around add_pathspec_matches_against_index()
61 * which allocates, populates, and returns a seen[] array indicating the
62 * nature of the "closest" (i.e. most specific) matches which each of the
63 * given pathspecs achieves against all items in the index.
65 char *find_pathspecs_matching_against_index(const struct pathspec
*pathspec
,
66 struct index_state
*istate
,
67 enum ps_skip_worktree_action sw_action
)
69 char *seen
= xcalloc(pathspec
->nr
, 1);
70 add_pathspec_matches_against_index(pathspec
, istate
, seen
, sw_action
);
74 char *find_pathspecs_matching_skip_worktree(const struct pathspec
*pathspec
)
76 struct index_state
*istate
= the_repository
->index
;
77 char *seen
= xcalloc(pathspec
->nr
, 1);
80 for (i
= 0; i
< istate
->cache_nr
; i
++) {
81 struct cache_entry
*ce
= istate
->cache
[i
];
82 if (ce_skip_worktree(ce
) || !path_in_sparse_checkout(ce
->name
, istate
))
83 ce_path_match(istate
, ce
, pathspec
, seen
);
92 * Possible future magic semantics include stuff like:
94 * { PATHSPEC_RECURSIVE, '*', "recursive" },
95 * { PATHSPEC_REGEXP, '\0', "regexp" },
99 static struct pathspec_magic
{
101 char mnemonic
; /* this cannot be ':'! */
103 } pathspec_magic
[] = {
104 { PATHSPEC_FROMTOP
, '/', "top" },
105 { PATHSPEC_LITERAL
, '\0', "literal" },
106 { PATHSPEC_GLOB
, '\0', "glob" },
107 { PATHSPEC_ICASE
, '\0', "icase" },
108 { PATHSPEC_EXCLUDE
, '!', "exclude" },
109 { PATHSPEC_ATTR
, '\0', "attr" },
112 static void prefix_magic(struct strbuf
*sb
, int prefixlen
, unsigned magic
)
115 strbuf_addstr(sb
, ":(");
116 for (i
= 0; i
< ARRAY_SIZE(pathspec_magic
); i
++)
117 if (magic
& pathspec_magic
[i
].bit
) {
118 if (sb
->buf
[sb
->len
- 1] != '(')
119 strbuf_addch(sb
, ',');
120 strbuf_addstr(sb
, pathspec_magic
[i
].name
);
122 strbuf_addf(sb
, ",prefix:%d)", prefixlen
);
125 static size_t strcspn_escaped(const char *s
, const char *stop
)
129 for (i
= s
; *i
; i
++) {
130 /* skip the escaped character */
131 if (i
[0] == '\\' && i
[1]) {
136 if (strchr(stop
, *i
))
142 static inline int invalid_value_char(const char ch
)
144 if (isalnum(ch
) || strchr(",-_", ch
))
149 static char *attr_value_unescape(const char *value
)
154 ret
= xmallocz(strlen(value
));
155 for (src
= value
, dst
= ret
; *src
; src
++, dst
++) {
158 die(_("Escape character '\\' not allowed as "
159 "last character in attr value"));
162 if (invalid_value_char(*src
))
163 die("cannot use '%c' for value matching", *src
);
170 static void parse_pathspec_attr_match(struct pathspec_item
*item
, const char *value
)
172 struct string_list_item
*si
;
173 struct string_list list
= STRING_LIST_INIT_DUP
;
175 if (item
->attr_check
|| item
->attr_match
)
176 die(_("Only one 'attr:' specification is allowed."));
178 if (!value
|| !*value
)
179 die(_("attr spec must not be empty"));
181 string_list_split(&list
, value
, ' ', -1);
182 string_list_remove_empty_items(&list
, 0);
184 item
->attr_check
= attr_check_alloc();
185 CALLOC_ARRAY(item
->attr_match
, list
.nr
);
187 for_each_string_list_item(si
, &list
) {
190 const struct git_attr
*a
;
192 int j
= item
->attr_match_nr
++;
193 const char *attr
= si
->string
;
194 struct attr_match
*am
= &item
->attr_match
[j
];
198 am
->match_mode
= MATCH_UNSPECIFIED
;
200 attr_len
= strlen(attr
);
203 am
->match_mode
= MATCH_UNSET
;
205 attr_len
= strlen(attr
);
208 attr_len
= strcspn(attr
, "=");
209 if (attr
[attr_len
] != '=')
210 am
->match_mode
= MATCH_SET
;
212 const char *v
= &attr
[attr_len
+ 1];
213 am
->match_mode
= MATCH_VALUE
;
214 am
->value
= attr_value_unescape(v
);
219 attr_name
= xmemdupz(attr
, attr_len
);
220 a
= git_attr(attr_name
);
222 die(_("invalid attribute name %s"), attr_name
);
224 attr_check_append(item
->attr_check
, a
);
229 if (item
->attr_check
->nr
!= item
->attr_match_nr
)
230 BUG("should have same number of entries");
232 string_list_clear(&list
, 0);
235 static inline int get_literal_global(void)
237 static int literal
= -1;
240 literal
= git_env_bool(GIT_LITERAL_PATHSPECS_ENVIRONMENT
, 0);
245 static inline int get_glob_global(void)
247 static int glob
= -1;
250 glob
= git_env_bool(GIT_GLOB_PATHSPECS_ENVIRONMENT
, 0);
255 static inline int get_noglob_global(void)
257 static int noglob
= -1;
260 noglob
= git_env_bool(GIT_NOGLOB_PATHSPECS_ENVIRONMENT
, 0);
265 static inline int get_icase_global(void)
267 static int icase
= -1;
270 icase
= git_env_bool(GIT_ICASE_PATHSPECS_ENVIRONMENT
, 0);
275 static int get_global_magic(int element_magic
)
277 int global_magic
= 0;
279 if (get_literal_global())
280 global_magic
|= PATHSPEC_LITERAL
;
282 /* --glob-pathspec is overridden by :(literal) */
283 if (get_glob_global() && !(element_magic
& PATHSPEC_LITERAL
))
284 global_magic
|= PATHSPEC_GLOB
;
286 if (get_glob_global() && get_noglob_global())
287 die(_("global 'glob' and 'noglob' pathspec settings are incompatible"));
289 if (get_icase_global())
290 global_magic
|= PATHSPEC_ICASE
;
292 if ((global_magic
& PATHSPEC_LITERAL
) &&
293 (global_magic
& ~PATHSPEC_LITERAL
))
294 die(_("global 'literal' pathspec setting is incompatible "
295 "with all other global pathspec settings"));
297 /* --noglob-pathspec adds :(literal) _unless_ :(glob) is specified */
298 if (get_noglob_global() && !(element_magic
& PATHSPEC_GLOB
))
299 global_magic
|= PATHSPEC_LITERAL
;
305 * Parse the pathspec element looking for long magic
307 * saves all magic in 'magic'
308 * if prefix magic is used, save the prefix length in 'prefix_len'
309 * returns the position in 'elem' after all magic has been parsed
311 static const char *parse_long_magic(unsigned *magic
, int *prefix_len
,
312 struct pathspec_item
*item
,
318 for (pos
= elem
+ 2; *pos
&& *pos
!= ')'; pos
= nextat
) {
319 size_t len
= strcspn_escaped(pos
, ",)");
323 nextat
= pos
+ len
+ 1; /* handle ',' */
325 nextat
= pos
+ len
; /* handle ')' and '\0' */
330 if (starts_with(pos
, "prefix:")) {
332 *prefix_len
= strtol(pos
+ 7, &endptr
, 10);
333 if (endptr
- pos
!= len
)
334 die(_("invalid parameter for pathspec magic 'prefix'"));
338 if (starts_with(pos
, "attr:")) {
339 char *attr_body
= xmemdupz(pos
+ 5, len
- 5);
340 parse_pathspec_attr_match(item
, attr_body
);
341 *magic
|= PATHSPEC_ATTR
;
346 for (i
= 0; i
< ARRAY_SIZE(pathspec_magic
); i
++) {
347 if (strlen(pathspec_magic
[i
].name
) == len
&&
348 !strncmp(pathspec_magic
[i
].name
, pos
, len
)) {
349 *magic
|= pathspec_magic
[i
].bit
;
354 if (ARRAY_SIZE(pathspec_magic
) <= i
)
355 die(_("Invalid pathspec magic '%.*s' in '%s'"),
356 (int) len
, pos
, elem
);
360 die(_("Missing ')' at the end of pathspec magic in '%s'"),
368 * Parse the pathspec element looking for short magic
370 * saves all magic in 'magic'
371 * returns the position in 'elem' after all magic has been parsed
373 static const char *parse_short_magic(unsigned *magic
, const char *elem
)
377 for (pos
= elem
+ 1; *pos
&& *pos
!= ':'; pos
++) {
381 /* Special case alias for '!' */
383 *magic
|= PATHSPEC_EXCLUDE
;
387 if (!is_pathspec_magic(ch
))
390 for (i
= 0; i
< ARRAY_SIZE(pathspec_magic
); i
++) {
391 if (pathspec_magic
[i
].mnemonic
== ch
) {
392 *magic
|= pathspec_magic
[i
].bit
;
397 if (ARRAY_SIZE(pathspec_magic
) <= i
)
398 die(_("Unimplemented pathspec magic '%c' in '%s'"),
408 static const char *parse_element_magic(unsigned *magic
, int *prefix_len
,
409 struct pathspec_item
*item
,
412 if (elem
[0] != ':' || get_literal_global())
413 return elem
; /* nothing to do */
414 else if (elem
[1] == '(')
416 return parse_long_magic(magic
, prefix_len
, item
, elem
);
419 return parse_short_magic(magic
, elem
);
423 * Perform the initialization of a pathspec_item based on a pathspec element.
425 static void init_pathspec_item(struct pathspec_item
*item
, unsigned flags
,
426 const char *prefix
, int prefixlen
,
429 unsigned magic
= 0, element_magic
= 0;
430 const char *copyfrom
= elt
;
432 int pathspec_prefix
= -1;
434 item
->attr_check
= NULL
;
435 item
->attr_match
= NULL
;
436 item
->attr_match_nr
= 0;
438 /* PATHSPEC_LITERAL_PATH ignores magic */
439 if (flags
& PATHSPEC_LITERAL_PATH
) {
440 magic
= PATHSPEC_LITERAL
;
442 copyfrom
= parse_element_magic(&element_magic
,
446 magic
|= element_magic
;
447 magic
|= get_global_magic(element_magic
);
452 if (pathspec_prefix
>= 0 &&
453 (prefixlen
|| (prefix
&& *prefix
)))
454 BUG("'prefix' magic is supposed to be used at worktree's root");
456 if ((magic
& PATHSPEC_LITERAL
) && (magic
& PATHSPEC_GLOB
))
457 die(_("%s: 'literal' and 'glob' are incompatible"), elt
);
459 /* Create match string which will be used for pathspec matching */
460 if (pathspec_prefix
>= 0) {
461 match
= xstrdup(copyfrom
);
462 prefixlen
= pathspec_prefix
;
463 } else if (magic
& PATHSPEC_FROMTOP
) {
464 match
= xstrdup(copyfrom
);
467 match
= prefix_path_gently(prefix
, prefixlen
,
468 &prefixlen
, copyfrom
);
470 const char *hint_path
;
473 die(_("'%s' is outside the directory tree"),
475 hint_path
= get_git_work_tree();
477 hint_path
= get_git_dir();
478 die(_("%s: '%s' is outside repository at '%s'"), elt
,
479 copyfrom
, absolute_path(hint_path
));
484 item
->len
= strlen(item
->match
);
485 item
->prefix
= prefixlen
;
488 * Prefix the pathspec (keep all magic) and assign to
489 * original. Useful for passing to another command.
491 if ((flags
& PATHSPEC_PREFIX_ORIGIN
) &&
492 !get_literal_global()) {
493 struct strbuf sb
= STRBUF_INIT
;
495 /* Preserve the actual prefix length of each pattern */
496 prefix_magic(&sb
, prefixlen
, element_magic
);
498 strbuf_addstr(&sb
, match
);
499 item
->original
= strbuf_detach(&sb
, NULL
);
501 item
->original
= xstrdup(elt
);
504 if (magic
& PATHSPEC_LITERAL
) {
505 item
->nowildcard_len
= item
->len
;
507 item
->nowildcard_len
= simple_length(item
->match
);
508 if (item
->nowildcard_len
< prefixlen
)
509 item
->nowildcard_len
= prefixlen
;
513 if (magic
& PATHSPEC_GLOB
) {
515 * FIXME: should we enable ONESTAR in _GLOB for
516 * pattern "* * / * . c"?
519 if (item
->nowildcard_len
< item
->len
&&
520 item
->match
[item
->nowildcard_len
] == '*' &&
521 no_wildcard(item
->match
+ item
->nowildcard_len
+ 1))
522 item
->flags
|= PATHSPEC_ONESTAR
;
525 /* sanity checks, pathspec matchers assume these are sane */
526 if (item
->nowildcard_len
> item
->len
||
527 item
->prefix
> item
->len
) {
528 BUG("error initializing pathspec_item");
532 static int pathspec_item_cmp(const void *a_
, const void *b_
)
534 struct pathspec_item
*a
, *b
;
536 a
= (struct pathspec_item
*)a_
;
537 b
= (struct pathspec_item
*)b_
;
538 return strcmp(a
->match
, b
->match
);
541 void pathspec_magic_names(unsigned magic
, struct strbuf
*out
)
544 for (i
= 0; i
< ARRAY_SIZE(pathspec_magic
); i
++) {
545 const struct pathspec_magic
*m
= pathspec_magic
+ i
;
546 if (!(magic
& m
->bit
))
549 strbuf_addstr(out
, ", ");
552 strbuf_addf(out
, _("'%s' (mnemonic: '%c')"),
553 m
->name
, m
->mnemonic
);
555 strbuf_addf(out
, "'%s'", m
->name
);
559 static void NORETURN
unsupported_magic(const char *pattern
,
562 struct strbuf sb
= STRBUF_INIT
;
563 pathspec_magic_names(magic
, &sb
);
565 * We may want to substitute "this command" with a command
566 * name. E.g. when "git add -p" or "git add -i" dies when running
569 die(_("%s: pathspec magic not supported by this command: %s"),
573 void parse_pathspec(struct pathspec
*pathspec
,
574 unsigned magic_mask
, unsigned flags
,
575 const char *prefix
, const char **argv
)
577 struct pathspec_item
*item
;
578 const char *entry
= argv
? *argv
: NULL
;
579 int i
, n
, prefixlen
, nr_exclude
= 0;
581 memset(pathspec
, 0, sizeof(*pathspec
));
583 if (flags
& PATHSPEC_MAXDEPTH_VALID
)
584 pathspec
->magic
|= PATHSPEC_MAXDEPTH
;
586 /* No arguments, no prefix -> no pathspec */
587 if (!entry
&& !prefix
)
590 if ((flags
& PATHSPEC_PREFER_CWD
) &&
591 (flags
& PATHSPEC_PREFER_FULL
))
592 BUG("PATHSPEC_PREFER_CWD and PATHSPEC_PREFER_FULL are incompatible");
594 /* No arguments with prefix -> prefix pathspec */
596 if (flags
& PATHSPEC_PREFER_FULL
)
599 if (!(flags
& PATHSPEC_PREFER_CWD
))
600 BUG("PATHSPEC_PREFER_CWD requires arguments");
602 pathspec
->items
= CALLOC_ARRAY(item
, 1);
603 item
->match
= xstrdup(prefix
);
604 item
->original
= xstrdup(prefix
);
605 item
->nowildcard_len
= item
->len
= strlen(prefix
);
606 item
->prefix
= item
->len
;
613 if (*argv
[n
] == '\0')
614 die("empty string is not a valid pathspec. "
615 "please use . instead if you meant to match all paths");
620 ALLOC_ARRAY(pathspec
->items
, n
+ 1);
621 item
= pathspec
->items
;
622 prefixlen
= prefix
? strlen(prefix
) : 0;
624 for (i
= 0; i
< n
; i
++) {
627 init_pathspec_item(item
+ i
, flags
, prefix
, prefixlen
, entry
);
629 if (item
[i
].magic
& PATHSPEC_EXCLUDE
)
631 if (item
[i
].magic
& magic_mask
)
632 unsupported_magic(entry
, item
[i
].magic
& magic_mask
);
634 if ((flags
& PATHSPEC_SYMLINK_LEADING_PATH
) &&
635 has_symlink_leading_path(item
[i
].match
, item
[i
].len
)) {
636 die(_("pathspec '%s' is beyond a symbolic link"), entry
);
639 if (item
[i
].nowildcard_len
< item
[i
].len
)
640 pathspec
->has_wildcard
= 1;
641 pathspec
->magic
|= item
[i
].magic
;
645 * If everything is an exclude pattern, add one positive pattern
646 * that matches everything. We allocated an extra one for this.
648 if (nr_exclude
== n
) {
649 int plen
= (!(flags
& PATHSPEC_PREFER_CWD
)) ? 0 : prefixlen
;
650 init_pathspec_item(item
+ n
, 0, prefix
, plen
, ".");
654 if (pathspec
->magic
& PATHSPEC_MAXDEPTH
) {
655 if (flags
& PATHSPEC_KEEP_ORDER
)
656 BUG("PATHSPEC_MAXDEPTH_VALID and PATHSPEC_KEEP_ORDER are incompatible");
657 QSORT(pathspec
->items
, pathspec
->nr
, pathspec_item_cmp
);
661 void parse_pathspec_file(struct pathspec
*pathspec
, unsigned magic_mask
,
662 unsigned flags
, const char *prefix
,
663 const char *file
, int nul_term_line
)
665 struct strvec parsed_file
= STRVEC_INIT
;
666 strbuf_getline_fn getline_fn
= nul_term_line
? strbuf_getline_nul
:
668 struct strbuf buf
= STRBUF_INIT
;
669 struct strbuf unquoted
= STRBUF_INIT
;
672 if (!strcmp(file
, "-"))
675 in
= xfopen(file
, "r");
677 while (getline_fn(&buf
, in
) != EOF
) {
678 if (!nul_term_line
&& buf
.buf
[0] == '"') {
679 strbuf_reset(&unquoted
);
680 if (unquote_c_style(&unquoted
, buf
.buf
, NULL
))
681 die(_("line is badly quoted: %s"), buf
.buf
);
682 strbuf_swap(&buf
, &unquoted
);
684 strvec_push(&parsed_file
, buf
.buf
);
688 strbuf_release(&unquoted
);
689 strbuf_release(&buf
);
693 parse_pathspec(pathspec
, magic_mask
, flags
, prefix
, parsed_file
.v
);
694 strvec_clear(&parsed_file
);
697 void copy_pathspec(struct pathspec
*dst
, const struct pathspec
*src
)
702 DUP_ARRAY(dst
->items
, src
->items
, dst
->nr
);
704 for (i
= 0; i
< dst
->nr
; i
++) {
705 struct pathspec_item
*d
= &dst
->items
[i
];
706 struct pathspec_item
*s
= &src
->items
[i
];
708 d
->match
= xstrdup(s
->match
);
709 d
->original
= xstrdup(s
->original
);
711 DUP_ARRAY(d
->attr_match
, s
->attr_match
, d
->attr_match_nr
);
712 for (j
= 0; j
< d
->attr_match_nr
; j
++) {
713 const char *value
= s
->attr_match
[j
].value
;
714 d
->attr_match
[j
].value
= xstrdup_or_null(value
);
717 d
->attr_check
= attr_check_dup(s
->attr_check
);
721 void clear_pathspec(struct pathspec
*pathspec
)
725 for (i
= 0; i
< pathspec
->nr
; i
++) {
726 free(pathspec
->items
[i
].match
);
727 free(pathspec
->items
[i
].original
);
729 for (j
= 0; j
< pathspec
->items
[i
].attr_match_nr
; j
++)
730 free(pathspec
->items
[i
].attr_match
[j
].value
);
731 free(pathspec
->items
[i
].attr_match
);
733 if (pathspec
->items
[i
].attr_check
)
734 attr_check_free(pathspec
->items
[i
].attr_check
);
737 FREE_AND_NULL(pathspec
->items
);
741 int match_pathspec_attrs(struct index_state
*istate
,
742 const char *name
, int namelen
,
743 const struct pathspec_item
*item
)
746 char *to_free
= NULL
;
749 name
= to_free
= xmemdupz(name
, namelen
);
751 git_check_attr(istate
, name
, item
->attr_check
);
755 for (i
= 0; i
< item
->attr_match_nr
; i
++) {
758 enum attr_match_mode match_mode
;
760 value
= item
->attr_check
->items
[i
].value
;
761 match_mode
= item
->attr_match
[i
].match_mode
;
763 if (ATTR_TRUE(value
))
764 matched
= (match_mode
== MATCH_SET
);
765 else if (ATTR_FALSE(value
))
766 matched
= (match_mode
== MATCH_UNSET
);
767 else if (ATTR_UNSET(value
))
768 matched
= (match_mode
== MATCH_UNSPECIFIED
);
770 matched
= (match_mode
== MATCH_VALUE
&&
771 !strcmp(item
->attr_match
[i
].value
, value
));
779 int pathspec_needs_expanded_index(struct index_state
*istate
,
780 const struct pathspec
*pathspec
)
784 char *skip_worktree_seen
= NULL
;
787 * If index is not sparse, no index expansion is needed.
789 if (!istate
->sparse_index
)
793 * When using a magic pathspec, assume for the sake of simplicity that
794 * the index needs to be expanded to match all matchable files.
799 for (i
= 0; i
< pathspec
->nr
; i
++) {
800 struct pathspec_item item
= pathspec
->items
[i
];
803 * If the pathspec item has a wildcard, the index should be expanded
804 * if the pathspec has the possibility of matching a subset of entries inside
805 * of a sparse directory (but not the entire directory).
807 * If the pathspec item is a literal path, the index only needs to be expanded
808 * if a) the pathspec isn't in the sparse checkout cone (to make sure we don't
809 * expand for in-cone files) and b) it doesn't match any sparse directories
810 * (since we can reset whole sparse directories without expanding them).
812 if (item
.nowildcard_len
< item
.len
) {
814 * Special case: if the pattern is a path inside the cone
815 * followed by only wildcards, the pattern cannot match
816 * partial sparse directories, so we know we don't need to
820 * - in-cone/foo***: doesn't need expanded index
821 * - not-in-cone/bar*: may need expanded index
822 * - **.c: may need expanded index
824 if (strspn(item
.original
+ item
.nowildcard_len
, "*") == item
.len
- item
.nowildcard_len
&&
825 path_in_cone_mode_sparse_checkout(item
.original
, istate
))
828 for (pos
= 0; pos
< istate
->cache_nr
; pos
++) {
829 struct cache_entry
*ce
= istate
->cache
[pos
];
831 if (!S_ISSPARSEDIR(ce
->ce_mode
))
835 * If the pre-wildcard length is longer than the sparse
836 * directory name and the sparse directory is the first
837 * component of the pathspec, need to expand the index.
839 if (item
.nowildcard_len
> ce_namelen(ce
) &&
840 !strncmp(item
.original
, ce
->name
, ce_namelen(ce
))) {
846 * If the pre-wildcard length is shorter than the sparse
847 * directory and the pathspec does not match the whole
848 * directory, need to expand the index.
850 if (!strncmp(item
.original
, ce
->name
, item
.nowildcard_len
) &&
851 wildmatch(item
.original
, ce
->name
, 0)) {
856 } else if (!path_in_cone_mode_sparse_checkout(item
.original
, istate
) &&
857 !matches_skip_worktree(pathspec
, i
, &skip_worktree_seen
))
864 free(skip_worktree_seen
);