git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] sparse-index.c: don't call prepare_repo_settings() twice in a row

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 5, 2021, 12:11 UTC
Message-ID
<patch-2.2-8bca02efcee-20210505T121028Z-avarab@gmail.com>
In-Reply-To
<cover-0.2-00000000000-20210505T121028Z-avarab@gmail.com>

Change code added in 58300f47432 (sparse-index: add index.sparse config option, 2021-03-30) to only call prepare_repo_settings() once. We know that our own set_sparse_index_config() has just finished calling it, so we don't need to call it if we're acting on "test_env".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 sparse-index.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sparse-index.c b/sparse-index.c
index b0d5dc5f081..5bad05de645 100644
--- a/sparse-index.c
+++ b/sparse-index.c
@@ -133,11 +133,12 @@ int convert_to_sparse(struct index_state *istate)
 	test_env = git_env_bool("GIT_TEST_SPARSE_INDEX", -1);
 	if (test_env >= 0)
 		set_sparse_index_config(istate->repo, test_env);
+	else
+		prepare_repo_settings(istate->repo);
 
 	/*
 	 * Only convert to sparse if index.sparse is set.
 	 */
-	prepare_repo_settings(istate->repo);
 	if (!istate->repo->settings.sparse_index)
 		return 0;
 
-- 
2.31.1.838.g7ac6e98bb53
Previous: Derrick StoleeNext: Derrick Stolee
Message 4 of 8 in “sparse-index.c: minor prepare_repo_settings() fixes”
  1. 0/2 sparse-index.c: minor prepare_repo_settings() fixesÆvar Arnfjörð Bjarmason, May 5, 2021
  2. 1/2 sparse-index.c: remove set_index_sparse_config()Ævar Arnfjörð Bjarmason, May 5, 2021
  3. Derrick StoleeMay 5, 2021
  4. 2/2 sparse-index.c: don't call prepare_repo_settings() twice in a rowÆvar Arnfjörð Bjarmason, May 5, 2021
  5. Derrick StoleeMay 5, 2021
  6. Junio C HamanoMay 6, 2021
  7. Ævar Arnfjörð BjarmasonMay 6, 2021
  8. Derrick StoleeMay 17, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.