summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-07-13 16:52:49 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-07-13 16:52:49 -0700
commit5d96bcbc0602f96ccee3111ff93b05389cd6eae6 (patch)
tree242c2ce22d0e5a6d54ad3a25335466cf3580fde0 /builtin
parentThe third batch (diff)
parentcat-file: merge two block into one (diff)
downloadtgif-5d96bcbc0602f96ccee3111ff93b05389cd6eae6.tar.xz
Merge branch 'zh/cat-file-batch-fix'
"git cat-file --batch-all-objects"" misbehaved when "--batch" is in use and did not ask for certain object traits. * zh/cat-file-batch-fix: cat-file: merge two block into one cat-file: handle trivial --batch format with --batch-all-objects
Diffstat (limited to 'builtin')
-rw-r--r--builtin/cat-file.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 5ebf13359e..243fe6844b 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -512,12 +512,6 @@ static int batch_objects(struct batch_options *opt)
if (opt->cmdmode)
data.split_on_whitespace = 1;
- if (opt->all_objects) {
- struct object_info empty = OBJECT_INFO_INIT;
- if (!memcmp(&data.info, &empty, sizeof(empty)))
- data.skip_object_info = 1;
- }
-
/*
* If we are printing out the object, then always fill in the type,
* since we will want to decide whether or not to stream.
@@ -527,6 +521,10 @@ static int batch_objects(struct batch_options *opt)
if (opt->all_objects) {
struct object_cb_data cb;
+ struct object_info empty = OBJECT_INFO_INIT;
+
+ if (!memcmp(&data.info, &empty, sizeof(empty)))
+ data.skip_object_info = 1;
if (has_promisor_remote())
warning("This repository uses promisor remotes. Some objects may not be loaded.");