Skip to content

Commit c8f4357

Browse files
peffgitster
authored andcommitted
pack-bitmap.c: trace bitmap ignore logs when midx-bitmap is found
When we find a midx bitmap, we do not bother checking for pack bitmaps, since we can use only one. But since we will warn of unused bitmaps via trace2, let's continue looking for pack bitmaps when tracing is enabled. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Teng Long <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 833f4c0 commit c8f4357

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

pack-bitmap.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,6 @@ static int open_pack_bitmap(struct repository *r,
524524
struct packed_git *p;
525525
int ret = -1;
526526

527-
assert(!bitmap_git->map);
528-
529527
for (p = get_all_packs(r); p; p = p->next) {
530528
if (open_pack_bitmap_1(bitmap_git, p) == 0) {
531529
ret = 0;
@@ -559,11 +557,20 @@ static int open_midx_bitmap(struct repository *r,
559557
static int open_bitmap(struct repository *r,
560558
struct bitmap_index *bitmap_git)
561559
{
560+
int found;
561+
562562
assert(!bitmap_git->map);
563563

564-
if (!open_midx_bitmap(r, bitmap_git))
565-
return 0;
566-
return open_pack_bitmap(r, bitmap_git);
564+
found = !open_midx_bitmap(r, bitmap_git);
565+
566+
/*
567+
* these will all be skipped if we opened a midx bitmap; but run it
568+
* anyway if tracing is enabled to report the duplicates
569+
*/
570+
if (!found || trace2_is_enabled())
571+
found |= !open_pack_bitmap(r, bitmap_git);
572+
573+
return found ? 0 : -1;
567574
}
568575

569576
struct bitmap_index *prepare_bitmap_git(struct repository *r)

0 commit comments

Comments
 (0)