Skip to content

Commit

Permalink
checkout-index: improve ensure_full_index scope in checkout_all
Browse files Browse the repository at this point in the history
Update `checkout_all` to only run `ensure_full_index` when entries in
sparse directories are needed (i.e., `--sparse` is specified).

Signed-off-by: Victoria Dye <vdye@github.com>
  • Loading branch information
vdye authored and ldennington committed Jan 20, 2022
1 parent 5d7dc8d commit 199ab5b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions builtin/checkout-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ static int checkout_all(const char *prefix, int prefix_length, int include_spars
int i, errs = 0;
struct cache_entry *last_ce = NULL;

/* TODO: audit for interaction with sparse-index. */
ensure_full_index(&the_index);
if (include_sparse)
ensure_full_index(&the_index);

for (i = 0; i < active_nr ; i++) {
struct cache_entry *ce = active_cache[i];
if (!include_sparse && !path_in_sparse_checkout(ce->name, &the_index))
Expand Down

0 comments on commit 199ab5b

Please sign in to comment.