Skip to content

Commit a42090a

Browse files
derrickstoleedscho
authored andcommitted
Merge pull request #414: Make sparse index the default
This branch is exactly #410, but with one more commit: enabling the sparse index by default in d59110a. Having this in the `vfs-2.33.0` branch helps build confidence that the sparse index is doing what it should be doing by running in the Scalar functional tests and in our test branches. If we want to cut a new `microsoft/git` release without enabling the sparse index, we can simply revert this commit.
2 parents ecde029 + 38cd027 commit a42090a

5 files changed

+5
-4
lines changed

repo-settings.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void prepare_repo_settings(struct repository *r)
7373
repo_cfg_bool(r, "fetch.writecommitgraph", &r->settings.fetch_write_commit_graph, 0);
7474
repo_cfg_bool(r, "pack.usesparse", &r->settings.pack_use_sparse, 1);
7575
repo_cfg_bool(r, "core.multipackindex", &r->settings.core_multi_pack_index, 1);
76-
repo_cfg_bool(r, "index.sparse", &r->settings.sparse_index, 0);
76+
repo_cfg_bool(r, "index.sparse", &r->settings.sparse_index, 1);
7777

7878
/*
7979
* The GIT_TEST_MULTI_PACK_INDEX variable is special in that

sparse-index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ int set_sparse_index_config(struct repository *repo, int enable)
103103
char *config_path = repo_git_path(repo, "config.worktree");
104104
res = git_config_set_in_file_gently(config_path,
105105
"index.sparse",
106-
enable ? "true" : NULL);
106+
enable ? "true" : "false");
107107
free(config_path);
108108

109109
prepare_repo_settings(repo);

t/t1091-sparse-checkout-builtin.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ test_expect_success 'sparse-index enabled and disabled' '
255255
test_cmp expect actual &&
256256
257257
git -C repo config --list >config &&
258-
! grep index.sparse config
258+
test_cmp_config -C repo false index.sparse
259259
'
260260

261261
test_expect_success 'cone mode: init and set' '

t/t1092-sparse-checkout-compatibility.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ init_repos () {
153153
git -C sparse-index reset --hard &&
154154

155155
# initialize sparse-checkout definitions
156+
git -C sparse-checkout config index.sparse false &&
156157
git -C sparse-checkout sparse-checkout init --cone &&
157158
git -C sparse-checkout sparse-checkout set deep &&
158159
git -C sparse-index sparse-checkout init --cone --sparse-index &&

t/t7817-grep-sparse-checkout.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ test_expect_success 'setup' '
4949
echo "text" >B/b &&
5050
git add A B &&
5151
git commit -m sub &&
52-
git sparse-checkout init --cone &&
52+
git sparse-checkout init --cone --no-sparse-index &&
5353
git sparse-checkout set B
5454
) &&
5555

0 commit comments

Comments
 (0)