diff --git a/Documentation/config/core.adoc b/Documentation/config/core.adoc index b9219080296e65..18b29c9507675e 100644 --- a/Documentation/config/core.adoc +++ b/Documentation/config/core.adoc @@ -116,7 +116,13 @@ core.virtualFilesystem:: will identify all files and directories that are present in the working directory. Git will only track and update files listed in the virtual file system. Using the virtual file system - will supersede the sparse-checkout settings which will be ignored. + will supersede the sparse-checkout settings which will be ignored, + unless the repository uses cone-mode sparse-checkout and sets + `index.sparse` to `true` (the default value does not count). Then + the cone patterns decide which directories collapse into + sparse-directory entries in the index. Git does not check the + working tree for a path inside such a directory, even when the + virtual file system lists the path. See the "virtual file system" section of linkgit:githooks[5]. core.trustctime:: diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c index a2b0ef074a47f4..e0ec68fe0e8451 100644 --- a/builtin/sparse-checkout.c +++ b/builtin/sparse-checkout.c @@ -126,6 +126,15 @@ static void clean_tracked_sparse_directories(struct repository *r) */ if (!r || !r->index || !r->worktree) return; + + /* + * A virtual file system owns the working tree, including the + * directories outside of the sparse-checkout cone. Do not delete + * them. + */ + if (repo_config_get_virtualfilesystem(the_repository)) + return; + if (init_sparse_checkout_patterns(r->index) || !r->index->sparse_checkout_patterns->use_cone_patterns) return; diff --git a/dir.c b/dir.c index f1703356ee5502..b3b6ca919658fe 100644 --- a/dir.c +++ b/dir.c @@ -1539,12 +1539,19 @@ enum pattern_match_result path_matches_pattern_list( int result = NOT_MATCHED; size_t slash_pos; - if (core_virtualfilesystem) { + if (core_virtualfilesystem && + !(pl->use_cone_patterns && vfs_sparse_index_configured())) { /* * The virtual file system data is used to prevent git from traversing * any part of the tree that is not in the virtual file system. Return * 1 to exclude the entry if it is not found in the virtual file system, * else fall through to the regular excludes logic as it may further exclude. + * + * Skip this for cone-mode patterns when + * vfs_sparse_index_configured() is true. Here, a return value of + * 1 means "in the cone", so a directory that the virtual file + * system does not report would be in the cone, and it could + * never collapse into a sparse-directory entry. */ if (*dtype == DT_UNKNOWN) *dtype = resolve_dtype(DT_UNKNOWN, istate, pathname, pathlen); @@ -1644,10 +1651,13 @@ static int path_in_sparse_checkout_1(const char *path, const char *end, *slash; /* - * When using a virtual filesystem, there aren't really patterns - * to follow, but be extra careful to skip this check. + * A virtual file system decides which paths are present, so the + * sparse-checkout patterns do not apply. The exception is a + * repository that sets index.sparse to true and uses cone mode + * (see vfs_uses_cone_patterns()). There, the cone patterns decide, + * so that convert_to_sparse() can collapse out-of-cone directories. */ - if (core_virtualfilesystem) + if (core_virtualfilesystem && !vfs_uses_cone_patterns(istate)) return 1; /* diff --git a/read-cache.c b/read-cache.c index 2657161e54a8ed..74cd25bc343b93 100644 --- a/read-cache.c +++ b/read-cache.c @@ -2371,11 +2371,17 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist) * If the command explicitly requires a full index, force it * to be full. Otherwise, correct the sparsity based on repository * settings and other properties of the index (if necessary). + * + * With a virtual file system, do not collapse a full index here. + * The skip-worktree bits that convert_to_sparse() checks are not + * correct until apply_virtualfilesystem() sets them, after this + * function. The index collapses when it is written. */ prepare_repo_settings(istate->repo); if (istate->repo->settings.command_requires_full_index) ensure_full_index_with_reason(istate, "incompatible builtin"); - else + else if (!repo_config_get_virtualfilesystem(the_repository) || + !vfs_uses_cone_patterns(istate)) ensure_correct_sparsity(istate); return istate->cache_nr; diff --git a/sparse-index.c b/sparse-index.c index e21a91c47649c3..cbeb0971e5cff7 100644 --- a/sparse-index.c +++ b/sparse-index.c @@ -411,6 +411,13 @@ void expand_index(struct index_state *istate, struct pattern_list *pl) struct pathspec ps; int dtype = DT_UNKNOWN; + /* + * The name-hash of 'istate' is discarded below, but 'full' + * reuses this entry. Clear CE_HASHED so that the next + * lazy_init_name_hash() adds the entry to the new name-hash. + */ + ce->ce_flags &= ~CE_HASHED; + if (!S_ISSPARSEDIR(ce->ce_mode)) { set_index_entry(full, full->cache_nr++, ce); continue; @@ -448,10 +455,7 @@ void expand_index(struct index_state *istate, struct pattern_list *pl) } /* Copy back into original index. */ - if (istate->name_hash_initialized) { - hashmap_clear(&istate->name_hash); - hashmap_clear(&istate->dir_hash); - } + free_name_hash(istate); istate->name_hash_initialized = full->name_hash_initialized; memcpy(&istate->name_hash, &full->name_hash, sizeof(full->name_hash)); diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c index 6b08ba8f078d00..34fc1e8e2b4bbb 100644 --- a/t/helper/test-read-cache.c +++ b/t/helper/test-read-cache.c @@ -3,27 +3,59 @@ #include "test-tool.h" #include "config.h" #include "environment.h" +#include "name-hash.h" #include "read-cache-ll.h" #include "repository.h" #include "setup.h" +#include "sparse-index.h" + +/* + * Look up 'name' in the name-hash, expand the index to a full index, and + * look it up again. The first lookup initializes the name-hash. + */ +static void expand_and_find(struct index_state *istate, const char *name) +{ + int before = !!index_file_exists(istate, name, strlen(name), 0); + + ensure_full_index(istate); + printf("%s: %s, %s\n", name, + before ? "found" : "not found", + index_file_exists(istate, name, strlen(name), 0) ? + "found" : "not found"); +} int cmd__read_cache(int argc, const char **argv) { int i, cnt = 1; const char *name = NULL; + const char *find_name = NULL; if (argc > 1 && skip_prefix(argv[1], "--print-and-refresh=", &name)) { argc--; argv++; } + if (argc > 1 && + skip_prefix(argv[1], "--expand-and-find=", &find_name)) { + argc--; + argv++; + } + if (argc == 2) cnt = strtol(argv[1], NULL, 0); setup_git_directory(the_repository); repo_config(the_repository, git_default_config, NULL); + if (find_name) { + /* Read the index as it is on disk, without an expansion. */ + prepare_repo_settings(the_repository); + the_repository->settings.command_requires_full_index = 0; + } + for (i = 0; i < cnt; i++) { repo_read_index(the_repository); + if (find_name) + expand_and_find(the_repository->index, find_name); if (name) { int pos; diff --git a/t/meson.build b/t/meson.build index 139269d6ebd95a..09ad8c1890d130 100644 --- a/t/meson.build +++ b/t/meson.build @@ -188,6 +188,8 @@ integration_tests = [ 't1091-sparse-checkout-builtin.sh', 't1092-sparse-checkout-compatibility.sh', 't1093-virtualfilesystem.sh', + 't1095-virtualfilesystem-sparse-index.sh', + 't1096-virtualfilesystem-sparse-cone.sh', 't1100-commit-tree-options.sh', 't1300-config.sh', 't1301-shared-repo.sh', diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh index a64cdcec91a2fe..d4cfbfb6817076 100755 --- a/t/t1092-sparse-checkout-compatibility.sh +++ b/t/t1092-sparse-checkout-compatibility.sh @@ -2863,4 +2863,39 @@ test_expect_success 'ensure_full_index_with_reason' ' "failed to clear skip-worktree while sparse" actual && + echo "deep/a: found, found" >expect && + test_cmp expect actual +' + +test_expect_success 'status with core.ignoreCase after the index expands' ' + git init icase && + ( + cd icase && + mkdir out zin && + for f in out/f zin/a zin/b + do + echo "$f" >$f || return 1 + done && + git add . && + git commit -m init && + git config core.ignoreCase true && + git config index.sparse true && + git config sparse.expectFilesOutsideOfPatterns true && + git sparse-checkout set zin && + + # If readdir() returns "out/" before "zin/" (as on NTFS), + # the lookup in "out/" expands the index before the walk + # looks up "zin/". The test above does not depend on this. + mkdir out && + echo new >out/new && + git status --porcelain >../icase-actual + ) && + echo "?? out/new" >expect && + test_cmp expect icase-actual +' + test_done diff --git a/t/t1095-virtualfilesystem-sparse-index.sh b/t/t1095-virtualfilesystem-sparse-index.sh new file mode 100755 index 00000000000000..d95dcd806c5843 --- /dev/null +++ b/t/t1095-virtualfilesystem-sparse-index.sh @@ -0,0 +1,173 @@ +#!/bin/sh + +test_description='virtual file system does not expand a sparse index + +apply_virtualfilesystem() runs on every index read. It sets the +skip-worktree bit on every index entry, then clears it for the paths that +the virtual file system hook reports. With a sparse index, a reported path +inside a sparse-directory entry must not expand the index, and the +sparse-directory entry must keep its skip-worktree bit.' + +GIT_TEST_SPLIT_INDEX=0 +GIT_TEST_SPARSE_INDEX= + +. ./test-lib.sh + +# Fail if the trace in "$1" shows that the index was expanded. +test_no_index_expansion () { + test_region ! index ensure_full_index "$1" && + test_region ! index expand_index "$1" && + test_grep ! expansion-reason "$1" +} + +# The hook reports the paths in .git/vfs-paths, one per line. +test_expect_success 'setup' ' + git init repo && + ( + cd repo && + mkdir -p in/deeper in/other out/sub && + for f in r in/a in/deeper/a in/other/a out/f1 out/f2 out/sub/f + do + echo "$f" >$f || return 1 + done && + git add . && + git commit -m init && + git config index.sparse true && + git sparse-checkout set in/deeper && + + git ls-files --sparse >files && + test_grep "^out/$" files && + test_grep "^in/other/$" files && + test_grep "^in/a$" files && + + write_script .git/hooks/virtualfilesystem <<-\EOF && + tr "\n" "\0" <.git/vfs-paths + EOF + git config core.virtualfilesystem .git/hooks/virtualfilesystem + ) +' + +test_expect_success 'paths inside sparse directories do not expand the index' ' + cat >repo/.git/vfs-paths <<-\EOF && + r + in/a + in/deeper/a + in/other/a + out/f1 + out/sub/f + out/sub/ + EOF + rm -f trace.txt && + GIT_TRACE2_EVENT="$(pwd)/trace.txt" \ + git -C repo -c core.ignorecase=false \ + ls-files -t --sparse >actual && + test_no_index_expansion trace.txt && + test_trace2_data vfs apply/nr_unknown 3 expect <<-\EOF && + H in/a + H in/deeper/a + S in/other/ + S out/ + H r + EOF + test_cmp expect actual +' + +test_expect_success 'directory wildcard keeps nested sparse directory' ' + cat >repo/.git/vfs-paths <<-\EOF && + in/ + EOF + rm -f trace.txt && + GIT_TRACE2_EVENT="$(pwd)/trace.txt" \ + git -C repo ls-files -t --sparse >actual && + test_no_index_expansion trace.txt && + + cat >expect <<-\EOF && + H in/a + H in/deeper/a + S in/other/ + S out/ + S r + EOF + test_cmp expect actual +' + +test_expect_success 'case-insensitive lookups still match in-cone paths' ' + cat >repo/.git/vfs-paths <<-\EOF && + IN/A + OUT/f1 + In/Other/ + EOF + rm -f trace.txt && + GIT_TRACE2_EVENT="$(pwd)/trace.txt" \ + git -C repo -c core.ignorecase=true \ + ls-files -t --sparse >actual && + test_no_index_expansion trace.txt && + + cat >expect <<-\EOF && + H in/a + S in/deeper/a + S in/other/ + S out/ + S r + EOF + test_cmp expect actual +' + +test_expect_success 'status reports in-cone changes without expanding' ' + test_when_finished "git -C repo checkout -- in/a" && + cat >repo/.git/vfs-paths <<-\EOF && + r + in/a + in/deeper/a + out/f1 + EOF + echo changed >>repo/in/a && + rm -f trace.txt && + GIT_TRACE2_EVENT="$(pwd)/trace.txt" \ + git -C repo status --porcelain --untracked-files=no >actual && + test_no_index_expansion trace.txt && + echo " M in/a" >expect && + test_cmp expect actual && + + git -C repo ls-files --sparse >files && + test_grep "^out/$" files +' + +test_expect_success 'full index keeps the original behavior' ' + git clone repo full && + ( + cd full && + git sparse-checkout set in/deeper && + git config index.sparse false && + git sparse-checkout reapply && + cp ../repo/.git/hooks/virtualfilesystem .git/hooks/ && + cat >.git/vfs-paths <<-\EOF && + r + in/a + in/deeper/a + out/f1 + out/sub/ + EOF + git config core.virtualfilesystem \ + .git/hooks/virtualfilesystem && + + GIT_TRACE2_EVENT="$(pwd)/../full-trace.txt" \ + git ls-files -t >../full-actual + ) && + test_trace2_data vfs apply/nr_unknown 0 expect <<-\EOF && + H in/a + H in/deeper/a + S in/other/a + H out/f1 + S out/f2 + H out/sub/f + H r + EOF + test_cmp expect full-actual +' + +test_done diff --git a/t/t1096-virtualfilesystem-sparse-cone.sh b/t/t1096-virtualfilesystem-sparse-cone.sh new file mode 100755 index 00000000000000..b57a3f09408c73 --- /dev/null +++ b/t/t1096-virtualfilesystem-sparse-cone.sh @@ -0,0 +1,224 @@ +#!/bin/sh + +test_description='cone-mode sparse-checkout under a virtual file system + +Without a sparse index, a virtual file system makes +path_in_sparse_checkout() report every path as inside the +sparse-checkout, so convert_to_sparse() never collapses a directory. +When the repository uses cone mode and sets index.sparse to true, the +cone patterns decide. The default value of index.sparse does not count. +Otherwise the behavior must not change.' + +GIT_TEST_SPLIT_INDEX=0 +GIT_TEST_SPARSE_INDEX= + +. ./test-lib.sh + +# Fail if the trace in "$1" shows that the index was expanded. +test_no_index_expansion () { + test_region ! index ensure_full_index "$1" && + test_region ! index expand_index "$1" && + test_grep ! expansion-reason "$1" +} + +# Create a cone-mode repository "$1" with the cone "in" and a full index. +create_cone_repo () { + git init "$1" && + ( + cd "$1" && + mkdir -p in out && + for f in r in/a out/f1 out/f2 + do + echo "$f" >$f || return 1 + done && + git add . && + git commit -m init && + git sparse-checkout set in && + git config index.sparse false && + git sparse-checkout reapply + ) +} + +# Enable a virtual file system in repository "$1". The hook reports the +# paths in .git/vfs-paths, one per line. A virtual file system shows all +# files in the working tree, so put the out-of-cone files back on disk. +enable_vfs () { + write_script "$1/.git/hooks/virtualfilesystem" <<-\EOF && + tr "\n" "\0" <.git/vfs-paths + EOF + cat >"$1/.git/vfs-paths" <<-\EOF && + r + in/a + EOF + mkdir "$1/out" && + echo out/f1 >"$1/out/f1" && + echo out/f2 >"$1/out/f2" && + git -C "$1" config core.virtualfilesystem .git/hooks/virtualfilesystem +} + +# Fail if a file of repository "$1" is missing from the working tree. +test_all_files_exist () { + test_path_is_file "$1/r" && + test_path_is_file "$1/in/a" && + test_path_is_file "$1/out/f1" && + test_path_is_file "$1/out/f2" +} + +test_expect_success 'setup' ' + create_cone_repo vfs && + enable_vfs vfs && + create_cone_repo novfs +' + +test_expect_success 'nothing collapses with index.sparse false' ' + git -C vfs sparse-checkout reapply && + test_all_files_exist vfs && + git -C vfs ls-files --sparse >actual && + cat >expect <<-\EOF && + in/a + out/f1 + out/f2 + r + EOF + test_cmp expect actual +' + +test_expect_success 'nothing collapses with the default index.sparse' ' + git -C vfs config --unset-all index.sparse && + test_might_fail git -C vfs config --worktree --unset-all index.sparse && + test_must_fail git -C vfs config index.sparse && + git -C vfs sparse-checkout reapply && + test_must_fail git -C vfs config index.sparse && + test_all_files_exist vfs && + git -C vfs ls-files --sparse >actual && + cat >expect <<-\EOF && + in/a + out/f1 + out/f2 + r + EOF + test_cmp expect actual +' + +test_expect_success 'out-of-cone directory collapses with index.sparse true' ' + git -C vfs config index.sparse true && + git -C vfs sparse-checkout reapply && + test_all_files_exist vfs && + git -C vfs ls-files -t --sparse >actual && + cat >expect <<-\EOF && + H in/a + S out/ + H r + EOF + test_cmp expect actual +' + +test_expect_success 'status keeps the index collapsed' ' + test_when_finished "git -C vfs checkout -- in/a" && + echo changed >>vfs/in/a && + rm -f trace.txt && + GIT_TRACE2_EVENT="$(pwd)/trace.txt" \ + git -C vfs status --porcelain --untracked-files=no >actual && + test_no_index_expansion trace.txt && + echo " M in/a" >expect && + test_cmp expect actual && + + git -C vfs ls-files --sparse >files && + test_grep "^out/$" files +' + +test_expect_success 'widening the cone keeps reported files' ' + test_when_finished "git -C vfs sparse-checkout set in" && + git -C vfs sparse-checkout add out && + test_all_files_exist vfs && + git -C vfs ls-files -t --sparse >actual && + cat >expect <<-\EOF && + H in/a + S out/f1 + S out/f2 + H r + EOF + test_cmp expect actual +' + +test_expect_success 'reapply on a collapsed index does not expand it' ' + test_when_finished "cp vfs/.git/vfs-paths.bak vfs/.git/vfs-paths" && + cp vfs/.git/vfs-paths vfs/.git/vfs-paths.bak && + echo out/f1 >>vfs/.git/vfs-paths && + rm -f trace.txt && + GIT_TRACE2_EVENT="$(pwd)/trace.txt" \ + git -C vfs sparse-checkout reapply && + test_region ! index ensure_full_index trace.txt && + test_grep ! expansion-reason trace.txt && + test_all_files_exist vfs && + git -C vfs ls-files -t --sparse >actual && + cat >expect <<-\EOF && + H in/a + S out/ + H r + EOF + test_cmp expect actual +' + +test_expect_success 'directory with a reported path does not collapse' ' + test_when_finished "cp vfs/.git/vfs-paths.bak vfs/.git/vfs-paths" && + cp vfs/.git/vfs-paths vfs/.git/vfs-paths.bak && + git -C vfs config index.sparse false && + git -C vfs sparse-checkout reapply && + echo out/f1 >>vfs/.git/vfs-paths && + git -C vfs config index.sparse true && + git -C vfs sparse-checkout reapply && + test_all_files_exist vfs && + git -C vfs ls-files -t --sparse >actual && + cat >expect <<-\EOF && + H in/a + H out/f1 + S out/f2 + H r + EOF + test_cmp expect actual +' + +test_expect_success 'non-cone sparse-checkout under a virtual file system' ' + git -C vfs sparse-checkout set --no-cone "/in/" && + git -C vfs config index.sparse true && + git -C vfs sparse-checkout reapply && + test_all_files_exist vfs && + git -C vfs ls-files -t --sparse >actual && + cat >expect <<-\EOF && + H in/a + S out/f1 + S out/f2 + H r + EOF + test_cmp expect actual +' + +test_expect_success 'without a virtual file system, cone mode is unchanged' ' + git -C novfs ls-files -t --sparse >actual && + cat >expect <<-\EOF && + H in/a + S out/f1 + S out/f2 + H r + EOF + test_cmp expect actual && + + git -C novfs config index.sparse true && + git -C novfs sparse-checkout reapply && + git -C novfs ls-files -t --sparse >actual && + cat >expect <<-\EOF && + H in/a + S out/ + H r + EOF + test_cmp expect actual && + + rm -f trace.txt && + GIT_TRACE2_EVENT="$(pwd)/trace.txt" \ + git -C novfs status --porcelain >actual && + test_no_index_expansion trace.txt && + test_must_be_empty actual +' + +test_done diff --git a/virtualfilesystem.c b/virtualfilesystem.c index 2d385896227aa0..3d7d71d1450070 100644 --- a/virtualfilesystem.c +++ b/virtualfilesystem.c @@ -9,7 +9,9 @@ #include "hashmap.h" #include "run-command.h" #include "name-hash.h" +#include "object.h" #include "read-cache-ll.h" +#include "sparse-index.h" #include "virtualfilesystem.h" #define HOOK_INTERFACE_VERSION (1) @@ -252,6 +254,30 @@ int is_excluded_from_virtualfilesystem(const char *pathname, int pathlen, int dt return -1; } +int vfs_sparse_index_configured(void) +{ + struct repo_config_values *cfg = repo_config_values(the_repository); + int sparse_index; + + if (!cfg->apply_sparse_checkout || !cfg->core_sparse_checkout_cone) + return 0; + return !repo_config_get_bool(the_repository, "index.sparse", + &sparse_index) && sparse_index; +} + +int vfs_uses_cone_patterns(struct index_state *istate) +{ + if (!istate || istate->split_index || !vfs_sparse_index_configured()) + return 0; + + /* + * This runs for each path, so do not use + * is_sparse_index_allowed(istate, 0): it reads the environment + * and can write the configuration. + */ + return is_sparse_index_allowed(istate, SPARSE_INDEX_MEMORY_ONLY); +} + struct apply_virtual_filesystem_stats { int nr_unknown; int nr_vfs_dirs; @@ -269,6 +295,17 @@ static void clear_ce_flags_virtualfilesystem_1(struct index_state *istate, int s if (!virtual_filesystem_data.len) get_virtual_filesystem_data(istate->repo, &virtual_filesystem_data); + /* + * The lookups below use index_name_pos_sparse(), not + * index_name_pos(). In a sparse index, a path inside a + * sparse-directory entry has no entry of its own, and + * index_name_pos() expands the whole index to find it. Here, such + * a path is not found, so the sparse-directory entry keeps its + * CE_SKIP_WORKTREE bit. With a full index, the two functions are + * the same. The name-hash does not contain sparse-directory + * entries, so the core.ignoreCase lookups do not expand the index. + */ + /* clear specified flag bits for everything in the virtual file system */ entry = buf = virtual_filesystem_data.buf; for (i = 0; i < virtual_filesystem_data.len; i++) { @@ -285,13 +322,21 @@ static void clear_ce_flags_virtualfilesystem_1(struct index_state *istate, int s stats->nr_vfs_dirs++; if (repo_ignore_case(the_repository)) adjust_dirname_case(istate, entry); - pos = index_name_pos(istate, entry, len); + pos = index_name_pos_sparse(istate, entry, len); if (pos < 0) { for (pos = -pos - 1; (size_t)pos < istate->cache_nr; pos++) { ce = istate->cache[pos]; if (fspathncmp(ce->name, entry, len)) break; + /* + * Keep CE_SKIP_WORKTREE on + * a sparse directory below + * this directory. + */ + if (S_ISSPARSEDIR(ce->ce_mode)) + continue; + if (select_mask && !(ce->ce_flags & select_mask)) continue; @@ -304,7 +349,7 @@ static void clear_ce_flags_virtualfilesystem_1(struct index_state *istate, int s if (repo_ignore_case(the_repository)) { ce = index_file_exists(istate, entry, len, repo_ignore_case(the_repository)); } else { - int pos = index_name_pos(istate, entry, len); + int pos = index_name_pos_sparse(istate, entry, len); ce = NULL; if (pos >= 0) diff --git a/virtualfilesystem.h b/virtualfilesystem.h index 7a31126ab9ea8c..31d3c139907bb1 100644 --- a/virtualfilesystem.h +++ b/virtualfilesystem.h @@ -24,6 +24,23 @@ int is_included_in_virtualfilesystem(const char *pathname, int pathlen); */ int is_excluded_from_virtualfilesystem(const char *pathname, int pathlen, int dtype); +/* + * With a virtual file system, return 1 if the configuration turns on a + * sparse index: cone-mode sparse-checkout and index.sparse set to true. + * The default value of index.sparse does not count. This reads only the + * configuration, not the sparse-checkout patterns. + */ +int vfs_sparse_index_configured(void); + +/* + * With a virtual file system, return 1 if the cone-mode sparse-checkout + * patterns of 'istate' decide which paths are in the sparse-checkout, + * so that the index can collapse into a sparse index. This requires + * vfs_sparse_index_configured() and a cone-mode pattern file. It loads + * the patterns into 'istate'. + */ +int vfs_uses_cone_patterns(struct index_state *istate); + /* * Free the virtual file system data structures. */