Imported Upstream version 2.27.0
[platform/upstream/git.git] / builtin / cat-file.c
index 272f9fc..ae18e20 100644 (file)
@@ -12,7 +12,7 @@
 #include "userdiff.h"
 #include "streaming.h"
 #include "tree-walk.h"
-#include "sha1-array.h"
+#include "oid-array.h"
 #include "packfile.h"
 #include "object-store.h"
 #include "promisor-remote.h"
@@ -42,7 +42,10 @@ static int filter_object(const char *path, unsigned mode,
                             oid_to_hex(oid), path);
        if ((type == OBJ_BLOB) && S_ISREG(mode)) {
                struct strbuf strbuf = STRBUF_INIT;
-               if (convert_to_working_tree(&the_index, path, *buf, *size, &strbuf)) {
+               struct checkout_metadata meta;
+
+               init_checkout_metadata(&meta, NULL, NULL, oid);
+               if (convert_to_working_tree(&the_index, path, *buf, *size, &strbuf, &meta)) {
                        free(*buf);
                        *size = strbuf.len;
                        *buf = strbuf_detach(&strbuf, NULL);
@@ -647,14 +650,14 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
                OPT_BOOL(0, "allow-unknown-type", &unknown_type,
                          N_("allow -s and -t to work with broken/corrupt objects")),
                OPT_BOOL(0, "buffer", &batch.buffer_output, N_("buffer --batch output")),
-               { OPTION_CALLBACK, 0, "batch", &batch, "format",
+               OPT_CALLBACK_F(0, "batch", &batch, "format",
                        N_("show info and content of objects fed from the standard input"),
                        PARSE_OPT_OPTARG | PARSE_OPT_NONEG,
-                       batch_option_callback },
-               { OPTION_CALLBACK, 0, "batch-check", &batch, "format",
+                       batch_option_callback),
+               OPT_CALLBACK_F(0, "batch-check", &batch, "format",
                        N_("show info about objects fed from the standard input"),
                        PARSE_OPT_OPTARG | PARSE_OPT_NONEG,
-                       batch_option_callback },
+                       batch_option_callback),
                OPT_BOOL(0, "follow-symlinks", &batch.follow_symlinks,
                         N_("follow in-tree symlinks (used with --batch or --batch-check)")),
                OPT_BOOL(0, "batch-all-objects", &batch.all_objects,