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 <peff@peff.net> Signed-off-by: Teng Long <dyroneteng@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Nov 28, 2022 at 22:09 UTC
c8f4357010b03db1cde5b514a481b3dbc4c34895
1 file changed
+12
-5
pack-bitmap.c
+12
-5
@@ -524,8 +524,6 @@ static int open_pack_bitmap(struct repository *r,
524
struct packed_git *p;
525
int ret = -1;
526
527
- assert(!bitmap_git->map);
528
-
527
for (p = get_all_packs(r); p; p = p->next) {
528
if (open_pack_bitmap_1(bitmap_git, p) == 0) {
529
ret = 0;
@@ -559,11 +557,20 @@ static int open_midx_bitmap(struct repository *r,
557
static int open_bitmap(struct repository *r,
558
struct bitmap_index *bitmap_git)
559
{
560
+ int found;
561
+
562
assert(!bitmap_git->map);
563
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;
574
}
575
576
struct bitmap_index *prepare_bitmap_git(struct repository *r)