pack-bitmap.c: break out of the bitmap loop early if not tracing
After opening a bitmap successfully, we try opening others only because we want to report that other bitmap files are ignored in the trace2 log. When trace2 is not enabled, we do not have to do any of that. 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
833f4c0514fb08368066ace5260b4b80792c4ffc
1 file changed
+8
-1
pack-bitmap.c
+8
-1
@@ -527,8 +527,15 @@ static int open_pack_bitmap(struct repository *r,
527
assert(!bitmap_git->map);
528
529
for (p = get_all_packs(r); p; p = p->next) {
530
- if (open_pack_bitmap_1(bitmap_git, p) == 0)
530
+ if (open_pack_bitmap_1(bitmap_git, p) == 0) {
531
ret = 0;
532
+ /*
533
+ * The only reason to keep looking is to report
534
+ * duplicates.
535
+ */
536
+ if (!trace2_is_enabled())
537
+ break;
538
+ }
539
}
540
541
return ret;