Thread (1 message) 1 message, 1 author, 2021-05-06

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

From: Junio C Hamano <hidden>
Date: 2021-05-06 03:55:31

Derrick Stolee [off-list ref] writes:
On 5/5/2021 8:11 AM, Ævar Arnfjörð Bjarmason wrote:
quoted
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".
I'm not sure about the value here. prepare_repo_settings() returns
quickly if the settings have already been prepared, so a second call
is negligible in cost.
quoted
@@ -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);
The change presented here to either call set_sparse_index_config()
_or_ prepare_repo_settings() seems like it knows too much about
how set_sparse_index_config() works.
I tend to agree on both counts.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help