Skip to content

Commit

Permalink
Merge pull request microsoft#414: Make sparse index the default
Browse files Browse the repository at this point in the history
This branch is exactly microsoft#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.
  • Loading branch information
derrickstolee authored and dscho committed Jan 20, 2022
2 parents 500ff3b + 75f3426 commit 52e37d8
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion repo-settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void prepare_repo_settings(struct repository *r)
repo_cfg_bool(r, "fetch.writecommitgraph", &r->settings.fetch_write_commit_graph, 0);
repo_cfg_bool(r, "pack.usesparse", &r->settings.pack_use_sparse, 1);
repo_cfg_bool(r, "core.multipackindex", &r->settings.core_multi_pack_index, 1);
repo_cfg_bool(r, "index.sparse", &r->settings.sparse_index, 0);
repo_cfg_bool(r, "index.sparse", &r->settings.sparse_index, 1);

/*
* The GIT_TEST_MULTI_PACK_INDEX variable is special in that
Expand Down
2 changes: 1 addition & 1 deletion sparse-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ int set_sparse_index_config(struct repository *repo, int enable)
char *config_path = repo_git_path(repo, "config.worktree");
res = git_config_set_in_file_gently(config_path,
"index.sparse",
enable ? "true" : NULL);
enable ? "true" : "false");
free(config_path);

prepare_repo_settings(repo);
Expand Down
2 changes: 1 addition & 1 deletion t/t1091-sparse-checkout-builtin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ test_expect_success 'sparse-index enabled and disabled' '
test_cmp expect actual &&
git -C repo config --list >config &&
! grep index.sparse config
test_cmp_config -C repo false index.sparse
'

test_expect_success 'cone mode: init and set' '
Expand Down
1 change: 1 addition & 0 deletions t/t1092-sparse-checkout-compatibility.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ init_repos () {
git -C sparse-index reset --hard &&

# initialize sparse-checkout definitions
git -C sparse-checkout config index.sparse false &&
git -C sparse-checkout sparse-checkout init --cone &&
git -C sparse-checkout sparse-checkout set deep &&
git -C sparse-index sparse-checkout init --cone --sparse-index &&
Expand Down
2 changes: 1 addition & 1 deletion t/t7817-grep-sparse-checkout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test_expect_success 'setup' '
echo "text" >B/b &&
git add A B &&
git commit -m sub &&
git sparse-checkout init --cone &&
git sparse-checkout init --cone --no-sparse-index &&
git sparse-checkout set B
) &&
Expand Down

0 comments on commit 52e37d8

Please sign in to comment.