diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-02-17 16:25:05 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-02-17 16:25:05 -0800 |
commit | 2f45f3e2bc859e5d5d29ede28de14f073c2dc227 (patch) | |
tree | 5ee746acec3fe482534dbb4c7c8b21c251b47115 /builtin/reset.c | |
parent | 708cbef33a2c905c920e94b70d0946f9f4ff3a4e (diff) | |
parent | b9ca5e26579ceb820103b49648c01187a4a0dddd (diff) |
Merge branch 'vd/sparse-clean-etc'
"git update-index", "git checkout-index", and "git clean" are
taught to work better with the sparse checkout feature.
* vd/sparse-clean-etc:
update-index: reduce scope of index expansion in do_reupdate
update-index: integrate with sparse index
update-index: add tests for sparse-checkout compatibility
checkout-index: integrate with sparse index
checkout-index: add --ignore-skip-worktree-bits option
checkout-index: expand sparse checkout compatibility tests
clean: integrate with sparse index
reset: reorder wildcard pathspec conditions
reset: fix validation in sparse index test
Diffstat (limited to 'builtin/reset.c')
-rw-r--r-- | builtin/reset.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/builtin/reset.c b/builtin/reset.c index b97745ee94..75b8d86481 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -204,10 +204,16 @@ static int pathspec_needs_expanded_index(const struct pathspec *pathspec) /* * Special case: if the pattern is a path inside the cone * followed by only wildcards, the pattern cannot match - * partial sparse directories, so we don't expand the index. + * partial sparse directories, so we know we don't need to + * expand the index. + * + * Examples: + * - in-cone/foo***: doesn't need expanded index + * - not-in-cone/bar*: may need expanded index + * - **.c: may need expanded index */ - if (path_in_cone_mode_sparse_checkout(item.original, &the_index) && - strspn(item.original + item.nowildcard_len, "*") == item.len - item.nowildcard_len) + if (strspn(item.original + item.nowildcard_len, "*") == item.len - item.nowildcard_len && + path_in_cone_mode_sparse_checkout(item.original, &the_index)) continue; for (pos = 0; pos < active_nr; pos++) { |