Re: [PATCH 2/2] sparse-index.c: don't call prepare_repo_settings() twice in a row
Derrick Stolee <stolee@gmail.com> writes:
Show 20 quoted lines
> 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.
>
>> @@ -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.