From: Junio C Hamano Date: Fri, 16 Jan 2026 20:40:26 +0000 (-0800) Subject: Merge branch 'jk/cat-file-avoid-bitmap-when-unneeded' X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c5f0adf21df709a17866bfa36bb0b1df6344ee6;p=thirdparty%2Fgit.git Merge branch 'jk/cat-file-avoid-bitmap-when-unneeded' Fix for a performance regression in "git cat-file". * jk/cat-file-avoid-bitmap-when-unneeded: cat-file: only use bitmaps when filtering --- 8c5f0adf21df709a17866bfa36bb0b1df6344ee6 diff --cc builtin/cat-file.c index 505ddaa12f,6d704ec6c9..3cb725940d --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@@ -846,15 -839,17 +846,17 @@@ static void batch_each_object(struct ba .callback = callback, .payload = _payload, }; - struct bitmap_index *bitmap = prepare_bitmap_git(the_repository); + struct bitmap_index *bitmap = NULL; - for_each_loose_object(batch_one_object_loose, &payload, 0); + for_each_loose_object(the_repository->objects, batch_one_object_loose, &payload, 0); - if (bitmap && !for_each_bitmapped_object(bitmap, &opt->objects_filter, - batch_one_object_bitmapped, &payload)) { + if (opt->objects_filter.choice != LOFC_DISABLED && + (bitmap = prepare_bitmap_git(the_repository)) && + !for_each_bitmapped_object(bitmap, &opt->objects_filter, + batch_one_object_bitmapped, &payload)) { struct packed_git *pack; - for (pack = get_all_packs(the_repository); pack; pack = pack->next) { + repo_for_each_pack(the_repository, pack) { if (bitmap_index_contains_pack(bitmap, pack) || open_pack_index(pack)) continue;