Skip to content

Commit

Permalink
sparse-index: fix index.sparse inline usage
Browse files Browse the repository at this point in the history
Update behavior when the `index.sparse` config setting is provided inline to
a command.  Previously would run command on sparse index (unless otherwise
expanded), then write out as sparse. Now, the index will be expanded in the
process of reading it in.

Co-authored-by: Derrick Stolee <[email protected]>
Signed-off-by: Victoria Dye <[email protected]>
  • Loading branch information
vdye and derrickstolee committed Nov 15, 2021
1 parent 4612a92 commit a2b2a2c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion read-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -2405,7 +2405,8 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
if (!istate->repo)
istate->repo = the_repository;
prepare_repo_settings(istate->repo);
if (istate->repo->settings.command_requires_full_index)
if (!istate->repo->settings.sparse_index ||
istate->repo->settings.command_requires_full_index)
ensure_full_index(istate);

return istate->cache_nr;
Expand Down

0 comments on commit a2b2a2c

Please sign in to comment.