Skip to content

Commit 299e2c4

Browse files
derrickstoleegitster
authored andcommitted
merge-index: ensure full index
Before iterating over all cache entries, ensure that a sparse index is expanded to a full one to avoid unexpected behavior. Signed-off-by: Derrick Stolee <[email protected]> Reviewed-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 42f44e8 commit 299e2c4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

builtin/merge-index.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ static void merge_one_path(const char *path)
5858
static void merge_all(void)
5959
{
6060
int i;
61+
/* TODO: audit for interaction with sparse-index. */
62+
ensure_full_index(&the_index);
6163
for (i = 0; i < active_nr; i++) {
6264
const struct cache_entry *ce = active_cache[i];
6365
if (!ce_stage(ce))
@@ -80,6 +82,9 @@ int cmd_merge_index(int argc, const char **argv, const char *prefix)
8082

8183
read_cache();
8284

85+
/* TODO: audit for interaction with sparse-index. */
86+
ensure_full_index(&the_index);
87+
8388
i = 1;
8489
if (!strcmp(argv[i], "-o")) {
8590
one_shot = 1;

0 commit comments

Comments
 (0)