Skip to content

Commit 5dcee7c

Browse files
dyronegitster
authored andcommitted
pack-bitmap.c: continue looping when first MIDX bitmap is found
In "open_midx_bitmap()", we do a loop with the MIDX(es) in repo, when the first one has been found, then will break out by a "return" directly. But actually, it's better to continue the loop until we have visited both the MIDX in our repository, as well as any alternates (along with _their_ alternates, recursively). The reason for this is, there may exist more than one MIDX file in a repo. The "multi_pack_index" struct is actually designed as a singly linked list, and if a MIDX file has been already opened successfully, then the other MIDX files will be skipped and left with a warning "ignoring extra bitmap file." to the output. The discussion link of community: https://public-inbox.org/git/[email protected]/ Helped-by: Taylor Blau <[email protected]> Signed-off-by: Teng Long <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9005eb0 commit 5dcee7c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pack-bitmap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,15 +506,16 @@ static int open_pack_bitmap(struct repository *r,
506506
static int open_midx_bitmap(struct repository *r,
507507
struct bitmap_index *bitmap_git)
508508
{
509+
int ret = -1;
509510
struct multi_pack_index *midx;
510511

511512
assert(!bitmap_git->map);
512513

513514
for (midx = get_multi_pack_index(r); midx; midx = midx->next) {
514515
if (!open_midx_bitmap_1(bitmap_git, midx))
515-
return 0;
516+
ret = 0;
516517
}
517-
return -1;
518+
return ret;
518519
}
519520

520521
static int open_bitmap(struct repository *r,

0 commit comments

Comments
 (0)