Skip to content

Commit 5bdf6d4

Browse files
avargitster
authored andcommitted
read-cache.c: refactor set_new_index_sparsity() for subsequent commit
Refactor code added to set_new_index_sparsity() in [1] to eliminate indentation resulting from putting the body of his function within the "if" block. Let's instead return early if we have no istate->repo. This trivial change makes the subsequent commit's diff smaller. 1. 491df5f (read-cache: set sparsity when index is new, 2022-05-10) Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Acked-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 29fefaf commit 5bdf6d4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

read-cache.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2292,12 +2292,12 @@ static void set_new_index_sparsity(struct index_state *istate)
22922292
* If the index's repo exists, mark it sparse according to
22932293
* repo settings.
22942294
*/
2295-
if (istate->repo) {
2296-
prepare_repo_settings(istate->repo);
2297-
if (!istate->repo->settings.command_requires_full_index &&
2298-
is_sparse_index_allowed(istate, 0))
2299-
istate->sparse_index = 1;
2300-
}
2295+
if (!istate->repo)
2296+
return;
2297+
prepare_repo_settings(istate->repo);
2298+
if (!istate->repo->settings.command_requires_full_index &&
2299+
is_sparse_index_allowed(istate, 0))
2300+
istate->sparse_index = 1;
23012301
}
23022302

23032303
/* remember to discard_cache() before reading a different cache! */

0 commit comments

Comments
 (0)