summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-03-17 00:53:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-03-17 00:53:08 (GMT)
commit190f9bf62a17ca6f97dee3f3818450ab2927215b (patch)
tree9535db8aff0d4abc101106628ab25be60aa7ac07 /dir.c
parent430883a70c79614e52279f2800a9a383ffc68fe5 (diff)
parentf27c170f645e6b8ed642c49c503964893ee26a4f (diff)
downloadgit-190f9bf62a17ca6f97dee3f3818450ab2927215b.zip
git-190f9bf62a17ca6f97dee3f3818450ab2927215b.tar.gz
git-190f9bf62a17ca6f97dee3f3818450ab2927215b.tar.bz2
Merge branch 'vd/sparse-read-tree'
"git read-tree" has been made to be aware of the sparse-index feature. * vd/sparse-read-tree: read-tree: make three-way merge sparse-aware read-tree: make two-way merge sparse-aware read-tree: narrow scope of index expansion for '--prefix' read-tree: integrate with sparse index read-tree: expand sparse checkout test coverage read-tree: explicitly disallow prefixes with a leading '/' status: fix nested sparse directory diff in sparse index sparse-index: prevent repo root from becoming sparse
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/dir.c b/dir.c
index 3b37022..f2b0f24 100644
--- a/dir.c
+++ b/dir.c
@@ -1463,10 +1463,11 @@ static int path_in_sparse_checkout_1(const char *path,
const char *end, *slash;
/*
- * We default to accepting a path if there are no patterns or
- * they are of the wrong type.
+ * We default to accepting a path if the path is empty, there are no
+ * patterns, or the patterns are of the wrong type.
*/
- if (init_sparse_checkout_patterns(istate) ||
+ if (!*path ||
+ init_sparse_checkout_patterns(istate) ||
(require_cone_mode &&
!istate->sparse_checkout_patterns->use_cone_patterns))
return 1;