mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
checkout-index: ensure full index
Before we iterate over all cache entries, ensure that the index is not sparse. This loop in checkout_all() might be safe to iterate over a sparse index, but let's put this protection here until it can be carefully tested. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
54beed24d2
commit
1b850d37f4
|
@ -119,6 +119,8 @@ static void checkout_all(const char *prefix, int prefix_length)
|
||||||
int i, errs = 0;
|
int i, errs = 0;
|
||||||
struct cache_entry *last_ce = NULL;
|
struct cache_entry *last_ce = NULL;
|
||||||
|
|
||||||
|
/* TODO: audit for interaction with sparse-index. */
|
||||||
|
ensure_full_index(&the_index);
|
||||||
for (i = 0; i < active_nr ; i++) {
|
for (i = 0; i < active_nr ; i++) {
|
||||||
struct cache_entry *ce = active_cache[i];
|
struct cache_entry *ce = active_cache[i];
|
||||||
if (ce_stage(ce) != checkout_stage
|
if (ce_stage(ce) != checkout_stage
|
||||||
|
|
Loading…
Reference in a new issue