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

[PATCH 08/27] commit: ensure full index

flat view
STALE2011d SUPERSEDED

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

Revision v1 of 3 in this series.

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

These two loops iterate over all cache entries, so ensure that a sparse
index is expanded to a full index before we do so.

Signed-off-by: Derrick Stolee <redacted>
---
 builtin/commit.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/builtin/commit.c b/builtin/commit.c
index 739110c5a7f6..9ea9e7b53390 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -251,6 +251,7 @@ static int list_paths(struct string_list *list, const char *with_tree,
 		free(max_prefix);
 	}
 
+	ensure_full_index(&the_index);
 	for (i = 0; i < active_nr; i++) {
 		const struct cache_entry *ce = active_cache[i];
 		struct string_list_item *item;
@@ -931,6 +932,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 		if (get_oid(parent, &oid)) {
 			int i, ita_nr = 0;
 
+			ensure_full_index(&the_index);
 			for (i = 0; i < active_nr; i++)
 				if (ce_intent_to_add(active_cache[i]))
 					ita_nr++;
-- 
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