Thread (105 messages) 105 messages, 5 authors, 2021-04-13

[PATCH 06/27] checkout-index: ensure full index

flat view
STALE2023d SUPERSEDED

From: Derrick Stolee via GitGitGadget <hidden>
Date: 2021-03-16 21:18:29
Subsystem: the rest · Maintainer: Linus Torvalds

Status: Superseded by v3 (posted 2021-04-12). [go to v3]

Revision v1 (3 revisions archived).

Revisions (3)
  1. v1 current
  2. v2 [diff against previous]
  3. v3 [diff against previous]
From: Derrick Stolee <redacted>

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 <redacted>
---
 builtin/checkout-index.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c
index 023e49e271c2..ba31a036f193 100644
--- a/builtin/checkout-index.c
+++ b/builtin/checkout-index.c
@@ -119,6 +119,7 @@ static void checkout_all(const char *prefix, int prefix_length)
 	int i, errs = 0;
 	struct cache_entry *last_ce = NULL;
 
+	ensure_full_index(&the_index);
 	for (i = 0; i < active_nr ; i++) {
 		struct cache_entry *ce = active_cache[i];
 		if (ce_stage(ce) != checkout_stage
-- 
gitgitgadget
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help