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 <dstolee@microsoft.com>
Signed-off-by: Victoria Dye <vdye@github.com>
  • Loading branch information
2 people authored and ldennington committed Jan 20, 2022
1 parent 3a7c5c0 commit dc4af28
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 @@ -2411,7 +2411,8 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
* settings and other properties of the index (if necessary).
*/
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);
else
ensure_correct_sparsity(istate);
Expand Down

0 comments on commit dc4af28

Please sign in to comment.