@@ -354,8 +354,8 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
354
354
if (bitmap_git -> pack || bitmap_git -> midx ) {
355
355
struct strbuf buf = STRBUF_INIT ;
356
356
get_midx_filename (& buf , midx -> object_dir );
357
- /* ignore extra bitmap file; we can only handle one */
358
- warning ( _ ( "ignoring extra bitmap file: '%s'" ) , buf .buf );
357
+ trace2_data_string ( " bitmap" , the_repository ,
358
+ "ignoring extra midx bitmap file" , buf .buf );
359
359
close (fd );
360
360
strbuf_release (& buf );
361
361
return -1 ;
@@ -411,9 +411,6 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git
411
411
struct stat st ;
412
412
char * bitmap_name ;
413
413
414
- if (open_pack_index (packfile ))
415
- return -1 ;
416
-
417
414
bitmap_name = pack_bitmap_filename (packfile );
418
415
fd = git_open (bitmap_name );
419
416
@@ -432,8 +429,8 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git
432
429
}
433
430
434
431
if (bitmap_git -> pack || bitmap_git -> midx ) {
435
- /* ignore extra bitmap file; we can only handle one */
436
- warning ( _ ( "ignoring extra bitmap file: '%s'" ) , packfile -> pack_name );
432
+ trace2_data_string ( " bitmap" , the_repository ,
433
+ "ignoring extra bitmap file" , packfile -> pack_name );
437
434
close (fd );
438
435
return -1 ;
439
436
}
@@ -458,6 +455,8 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git
458
455
return -1 ;
459
456
}
460
457
458
+ trace2_data_string ("bitmap" , the_repository , "opened bitmap file" ,
459
+ packfile -> pack_name );
461
460
return 0 ;
462
461
}
463
462
@@ -525,11 +524,16 @@ static int open_pack_bitmap(struct repository *r,
525
524
struct packed_git * p ;
526
525
int ret = -1 ;
527
526
528
- assert (!bitmap_git -> map );
529
-
530
527
for (p = get_all_packs (r ); p ; p = p -> next ) {
531
- if (open_pack_bitmap_1 (bitmap_git , p ) == 0 )
528
+ if (open_pack_bitmap_1 (bitmap_git , p ) == 0 ) {
532
529
ret = 0 ;
530
+ /*
531
+ * The only reason to keep looking is to report
532
+ * duplicates.
533
+ */
534
+ if (!trace2_is_enabled ())
535
+ break ;
536
+ }
533
537
}
534
538
535
539
return ret ;
@@ -553,11 +557,20 @@ static int open_midx_bitmap(struct repository *r,
553
557
static int open_bitmap (struct repository * r ,
554
558
struct bitmap_index * bitmap_git )
555
559
{
560
+ int found ;
561
+
556
562
assert (!bitmap_git -> map );
557
563
558
- if (!open_midx_bitmap (r , bitmap_git ))
559
- return 0 ;
560
- 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 ;
561
574
}
562
575
563
576
struct bitmap_index * prepare_bitmap_git (struct repository * r )
0 commit comments