Skip to content

Commit 33b1b4c

Browse files
newrengitster
authored andcommitted
sparse-checkout: avoid using internal API of unpack-trees, take 2
Commit 2f6b1eb ("cache API: add a "INDEX_STATE_INIT" macro/function, add release_index()", 2023-01-12) mistakenly added some initialization of a member of unpack_trees_options that was intended to be internal-only. This initialization should be done within update_sparsity() instead. Note that while o->result is mostly meant for unpack_trees() and update_sparsity() mostly operates without o->result, check_ok_to_remove() does consult it so we need to ensure it is properly initialized. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1147c56 commit 33b1b4c

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

builtin/sparse-checkout.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ static int update_working_directory(struct pattern_list *pl)
217217
o.head_idx = -1;
218218
o.src_index = r->index;
219219
o.dst_index = r->index;
220-
index_state_init(&o.result, r);
221220
o.skip_sparse_checkout = 0;
222221

223222
setup_work_tree();

unpack-trees.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,6 +2101,7 @@ enum update_sparsity_result update_sparsity(struct unpack_trees_options *o,
21012101

21022102
old_show_all_errors = o->show_all_errors;
21032103
o->show_all_errors = 1;
2104+
index_state_init(&o->result, o->src_index->repo);
21042105

21052106
/* Sanity checks */
21062107
if (!o->update || o->index_only || o->skip_sparse_checkout)

0 commit comments

Comments
 (0)