aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/cat-file.c8
-rwxr-xr-xt/perf/p1006-cat-file.sh14
2 files changed, 19 insertions, 3 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 67a5ff2b9e..6d704ec6c9 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -839,12 +839,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(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) {
diff --git a/t/perf/p1006-cat-file.sh b/t/perf/p1006-cat-file.sh
index dcd8015379..da34ece242 100755
--- a/t/perf/p1006-cat-file.sh
+++ b/t/perf/p1006-cat-file.sh
@@ -9,4 +9,18 @@ test_perf 'cat-file --batch-check' '
git cat-file --batch-all-objects --batch-check
'
+test_perf 'list all objects (sorted)' '
+ git cat-file --batch-all-objects --batch-check="%(objectname)"
+'
+
+test_perf 'list all objects (unsorted)' '
+ git cat-file --batch-all-objects --batch-check="%(objectname)" \
+ --unordered
+'
+
+test_perf 'list blobs' '
+ git cat-file --batch-all-objects --batch-check="%(objectname)" \
+ --unordered --filter=object:type=blob
+'
+
test_done