aboutsummaryrefslogtreecommitdiff
path: root/builtin/cat-file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-01-16 12:40:26 -0800
committerJunio C Hamano <gitster@pobox.com>2026-01-16 12:40:27 -0800
commit8c5f0adf21df709a17866bfa36bb0b1df6344ee6 (patch)
tree826644d3a34e35955d4ee6d35da5e98f6cee7721 /builtin/cat-file.c
parent18d7d02088792a1571db1d7677f89e398a71ad44 (diff)
parent9e8b448dd83297ac85f6a62a0d2408629fb45cc0 (diff)
downloadgit-8c5f0adf21df709a17866bfa36bb0b1df6344ee6.tar.xz
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
Diffstat (limited to 'builtin/cat-file.c')
-rw-r--r--builtin/cat-file.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 505ddaa12f..3cb725940d 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -846,12 +846,14 @@ static void batch_each_object(struct batch_options *opt,
.callback = callback,
.payload = _payload,
};
- struct bitmap_index *bitmap = prepare_bitmap_git(the_repository);
+ struct bitmap_index *bitmap = NULL;
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;
repo_for_each_pack(the_repository, pack) {