Skip to content

Commit cb8388d

Browse files
derrickstoleegitster
authored andcommitted
commit: ensure full index
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 <[email protected]> Reviewed-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0f6d3ba commit cb8388d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

builtin/commit.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ static int list_paths(struct string_list *list, const char *with_tree,
251251
free(max_prefix);
252252
}
253253

254+
/* TODO: audit for interaction with sparse-index. */
255+
ensure_full_index(&the_index);
254256
for (i = 0; i < active_nr; i++) {
255257
const struct cache_entry *ce = active_cache[i];
256258
struct string_list_item *item;
@@ -931,6 +933,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
931933
if (get_oid(parent, &oid)) {
932934
int i, ita_nr = 0;
933935

936+
/* TODO: audit for interaction with sparse-index. */
937+
ensure_full_index(&the_index);
934938
for (i = 0; i < active_nr; i++)
935939
if (ce_intent_to_add(active_cache[i]))
936940
ita_nr++;

0 commit comments

Comments
 (0)