Re: [PATCH 2/2] sparse-index.c: don't call prepare_repo_settings() twice in a row
- From
Derrick Stolee <stolee@gmail.com>
- Date
- May 5, 2021, 14:00 UTC
- Message-ID
- <7954338a-bb44-1345-61b6-787782063c3c@gmail.com>
- In-Reply-To
- <patch-2.2-8bca02efcee-20210505T121028Z-avarab@gmail.com>
On 5/5/2021 8:11 AM, Ævar Arnfjörð Bjarmason wrote:
> 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.
Show 6 quoted lines
> @@ -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.
Thanks, -Stolee