Revert "Merge branch 'ps/cat-file-remote-object-info' into next"

This reverts commit 606c48ef2dfe63eea916755fcf84f38ffc1abef4, reversing changes made to 15c7ad9a3fffd7c796bd4e730bb1b36e87020a66.

Junio C Hamano committed Jul 14, 2026 at 14:10 UTC 8e2bf96aa5bacd9f277397638fd9823d0be25e88
22 files changed +86 -1255
Documentation/git-cat-file.adoc
+7 -22
@@ -169,13 +169,6 @@ info <object>::
169 Print object info for object reference `<object>`. This corresponds to the
170 output of `--batch-check`.
171
172 -remote-object-info <remote> <object>...::
173 - Print object info for object references `<object>` at specified
174 - `<remote>` without downloading objects from the remote.
175 - Raise an error when the `object-info` capability is not supported by the remote.
176 - Raise an error when no object references are provided.
177 - This command may be combined with `--buffer`.
178 -
172 flush::
173 Used with `--buffer` to execute all preceding commands that were issued
174 since the beginning or since the last flush was issued. When `--buffer`
@@ -308,8 +301,7 @@ one per line, and print information based on the command given. With
301 `--batch-command`, the `info` command followed by an object will print
302 information about the object the same way `--batch-check` would, and the
303 `contents` command followed by an object prints contents in the same way
311 -`--batch` would. The `remote-object-info` command followed by a remote and
312 -objects IDs prints object info from the remote without downloading the objects.
304 +`--batch` would.
305
306 You can specify the information shown for each object by using a custom
307 `<format>`. The `<format>` is copied literally to stdout for each
@@ -332,12 +324,15 @@ newline. The available atoms are:
324 reports).
325
326 `objectsize:disk`::
335 - The size, in bytes, that the object takes up on disk.
327 + The size, in bytes, that the object takes up on disk. See the
328 + note about on-disk sizes in the `CAVEATS` section below.
329
330 `deltabase`::
331 If the object is stored as a delta on-disk, this expands to the
332 full hex representation of the delta base object name.
340 - Otherwise, expands to the null OID (all zeroes).
333 + Otherwise, expands to the null OID (all zeroes). See `CAVEATS`
334 + below.
335 +
336 `rest`::
337 If this atom is used in the output string, input lines are split
338 at the first whitespace boundary. All characters before that
@@ -345,14 +340,8 @@ newline. The available atoms are:
340 after that first run of whitespace (i.e., the "rest" of the
341 line) are output in place of the `%(rest)` atom.
342
348 -The command `remote-object-info` only supports the `%(objectname)` and
349 -`%(objectsize)` placeholders. See `CAVEATS` below for more information.
350 -
343 If no format is specified, the default format is `%(objectname)
352 -%(objecttype) %(objectsize)`, except for `remote-object-info` commands which
353 -use `%(objectname) %(objectsize)` because "%(objecttype)" is not supported yet.
354 -WARNING: When "%(objecttype)" is supported, the default format WILL be unified,
355 -so DO NOT RELY on the current default format to stay the same!!!
344 +%(objecttype) %(objectsize)`.
345
346 If `--batch` is specified, or if `--batch-command` is used with the `contents`
347 command, the object information is followed by the object contents (consisting
@@ -449,10 +438,6 @@ scripting purposes.
438 CAVEATS
439 -------
440
452 -Note that since only `%(objectname)` and `%(objectsize)` are currently
453 -supported by the `remote-object-info` command. Using any other placeholder in
454 -the format string will return an empty string in its position.
455 -
441 Note that the sizes of objects on disk are reported accurately, but care
442 should be taken in drawing conclusions about which refs or objects are
443 responsible for disk usage. The size of a packed non-delta object may be
Documentation/gitprotocol-v2.adoc
+3 -8
@@ -568,26 +568,21 @@ An `object-info` request takes the following arguments:
568
569 oid <oid>
570 Indicates to the server an object which the client wants to obtain
571 - information for. They must be full object IDs.
571 + information for.
572
573 The response of `object-info` is a list of the requested object ids
574 and associated requested information, each separated by a single space.
575
576 output = info flush-pkt
577
578 - info = PKT-LINE(attrs LF)
578 + info = PKT-LINE(attrs) LF)
579 *PKT-LINE(obj-info LF)
580
581 attrs = attr | attrs SP attrs
582
583 - obj-size = 1*DIGIT
584 -
583 attr = "size"
584
587 - obj-info = obj-id SP [obj-size]
588 -
589 - If the server does not recognize the object id, the response will be
590 - `obj-id SP` regardless of the number of attributes requested.
585 + obj-info = obj-id SP obj-size
586
587 bundle-uri
588 ~~~~~~~~~~
Makefile
-1
@@ -1170,7 +1170,6 @@ LIB_OBJS += ewah/ewah_rlw.o
1170 LIB_OBJS += exec-cmd.o
1171 LIB_OBJS += fetch-negotiator.o
1172 LIB_OBJS += fetch-pack.o
1173 -LIB_OBJS += fetch-object-info.o
1173 LIB_OBJS += fmt-merge-msg.o
1174 LIB_OBJS += fsck.o
1175 LIB_OBJS += fsmonitor.o
builtin/cat-file.c
+14 -207
@@ -29,22 +29,6 @@
29 #include "promisor-remote.h"
30 #include "mailmap.h"
31 #include "write-or-die.h"
32 -#include "alias.h"
33 -#include "remote.h"
34 -#include "transport.h"
35 -
36 -/*
37 - * Maximum length for a remote URL. While no universal standard exists,
38 - * 8K is assumed to be a reasonable limit.
39 - */
40 -#define MAX_REMOTE_URL_LEN (8 * 1024)
41 -
42 -/* Maximum number of objects allowed in a single remote-object-info request. */
43 -#define MAX_ALLOWED_OBJ_LIMIT 10000
44 -
45 -/* Maximum input size permitted for the remote-object-info command. */
46 -#define MAX_REMOTE_OBJ_INFO_LINE \
47 - (MAX_REMOTE_URL_LEN + MAX_ALLOWED_OBJ_LIMIT * (GIT_MAX_HEXSZ + 1))
32
33 enum batch_mode {
34 BATCH_MODE_CONTENTS,
@@ -333,16 +317,8 @@ struct expand_data {
317 * optimized out.
318 */
319 unsigned skip_object_info : 1;
336 -
337 - /*
338 - * Flags about when an object info is being fetched from remote.
339 - */
340 - unsigned is_remote:1;
341 -
342 - struct string_list remote_allowed_atoms;
320 };
344 -#define EXPAND_DATA_INIT { .mode = S_IFINVALID, .type = OBJ_BAD, \
345 - .remote_allowed_atoms = STRING_LIST_INIT_NODUP }
321 +#define EXPAND_DATA_INIT { .mode = S_IFINVALID }
322
323 static int is_atom(const char *atom, const char *s, int slen)
324 {
@@ -353,25 +329,14 @@ static int is_atom(const char *atom, const char *s, int slen)
329 static int expand_atom(struct strbuf *sb, const char *atom, int len,
330 struct expand_data *data)
331 {
356 - if (data->is_remote) {
357 - size_t i;
358 - for (i = 0; i < data->remote_allowed_atoms.nr; i++)
359 - if (is_atom(data->remote_allowed_atoms.items[i].string, atom, len))
360 - break;
361 - if (i == data->remote_allowed_atoms.nr)
362 - return 1;
363 - }
364 -
332 if (is_atom("objectname", atom, len)) {
333 if (!data->mark_query)
334 strbuf_add_oid_hex(sb, &data->oid);
335 } else if (is_atom("objecttype", atom, len)) {
369 - if (data->mark_query) {
336 + if (data->mark_query)
337 data->info.typep = &data->type;
371 - } else {
372 - const char *t = type_name(data->type);
373 - strbuf_addstr(sb, t ? t : "");
374 - }
338 + else
339 + strbuf_addstr(sb, type_name(data->type));
340 } else if (is_atom("objectsize", atom, len)) {
341 if (data->mark_query)
342 data->info.sizep = &data->size;
@@ -671,73 +636,6 @@ out:
636 object_context_release(&ctx);
637 }
638
674 -static int get_remote_info(struct batch_options *opt,
675 - int argc,
676 - const char **argv,
677 - struct object_info **remote_object_info,
678 - struct oid_array *object_info_oids,
679 - struct string_list *object_info_options)
680 -{
681 - int retval = 0;
682 - struct remote *remote = NULL;
683 - struct object_id oid;
684 - struct transport *gtransport;
685 -
686 - /*
687 - * TODO: Change the format to "%(objectname) %(objectsize)" when
688 - * remote-object-info command is used. Once we start supporting objecttype
689 - * the default format should change to DEFAULT_FORMAT.
690 - */
691 - if (!opt->format)
692 - opt->format = "%(objectname) %(objectsize)";
693 -
694 - remote = remote_get(argv[0]);
695 - if (!remote)
696 - die(_("must supply valid remote when using remote-object-info"));
697 -
698 - oid_array_clear(object_info_oids);
699 - for (size_t i = 1; i < argc; i++) {
700 - if (get_oid_hex(argv[i], &oid)) {
701 - size_t len = strlen(argv[i]);
702 -
703 - if (len < the_hash_algo->hexsz && len >= 4) {
704 - size_t j;
705 - for (j = 0; j < len; j++)
706 - if (!isxdigit(argv[i][j]))
707 - break;
708 - if (j == len)
709 - die(_("remote-object-info does not support "
710 - "short oids, %d characters required"),
711 - (int)the_hash_algo->hexsz);
712 - }
713 - die(_("not a valid object name '%s'"), argv[i]);
714 - }
715 - oid_array_append(object_info_oids, &oid);
716 - }
717 -
718 - if (!object_info_oids->nr)
719 - die(_("remote-object-info requires objects"));
720 -
721 - gtransport = transport_get(remote, NULL);
722 -
723 - if (!gtransport->smart_options) {
724 - retval = -1;
725 - goto cleanup;
726 - }
727 -
728 - CALLOC_ARRAY(*remote_object_info, object_info_oids->nr);
729 - gtransport->smart_options->object_info_oids = object_info_oids;
730 -
731 - if (object_info_options->nr > 0) {
732 - gtransport->smart_options->object_info_options = object_info_options;
733 - gtransport->smart_options->object_info_data = *remote_object_info;
734 - retval = transport_fetch_object_info(gtransport);
735 - }
736 -cleanup:
737 - transport_disconnect(gtransport);
738 - return retval;
739 -}
740 -
639 struct object_cb_data {
640 struct batch_options *opt;
641 struct expand_data *expand;
@@ -819,110 +717,18 @@ static void parse_cmd_mailmap(struct batch_options *opt UNUSED,
717 load_mailmap();
718 }
719
822 -struct protocol_placeholder_entry {
823 - const char *option;
824 - const char *atom;
825 -};
826 -
827 -static const struct protocol_placeholder_entry remote_atom_map[] = {
828 - {"size", "objectsize"},
829 - {"type", "objecttype"},
830 - /*
831 - * Add new protocol options here. Even if the server doesn't support
832 - * them the allow_list will drop them if the server doesn't advertise
833 - * them.
834 - */
835 -};
836 -
837 -static void parse_cmd_remote_object_info(struct batch_options *opt,
838 - const char *line, struct strbuf *output,
839 - struct expand_data *data)
840 -{
841 - int count;
842 - const char **argv;
843 - char *line_to_split;
844 - struct object_info *remote_object_info = NULL;
845 - struct oid_array object_info_oids = OID_ARRAY_INIT;
846 - struct string_list object_info_options = STRING_LIST_INIT_NODUP;
847 -
848 - if (strlen(line) >= MAX_REMOTE_OBJ_INFO_LINE)
849 - die(_("remote-object-info command too long"));
850 -
851 - line_to_split = xstrdup(line);
852 - count = split_cmdline(line_to_split, &argv);
853 - if (count < 0)
854 - die(_("remote-object-info: %s"), split_cmdline_strerror(count));
855 - if (count - 1 > MAX_ALLOWED_OBJ_LIMIT)
856 - die(_("remote-object-info supports at most %d objects"),
857 - MAX_ALLOWED_OBJ_LIMIT);
858 -
859 - if (data->info.sizep)
860 - string_list_append(&object_info_options, "size");
861 - if (data->info.typep)
862 - string_list_append(&object_info_options, "type");
863 -
864 - if (get_remote_info(opt, count, argv, &remote_object_info,
865 - &object_info_oids, &object_info_options))
866 - goto cleanup;
867 -
868 - string_list_clear(&data->remote_allowed_atoms, 0);
869 - string_list_append(&data->remote_allowed_atoms, "objectname");
870 - for (size_t i = 0; i < ARRAY_SIZE(remote_atom_map); i++)
871 - if (unsorted_string_list_has_string(&object_info_options, remote_atom_map[i].option))
872 - string_list_append(&data->remote_allowed_atoms,
873 - remote_atom_map[i].atom);
874 -
875 - data->skip_object_info = 1;
876 - for (size_t i = 0; i < object_info_oids.nr; i++) {
877 - int found = 0;
878 - data->oid = object_info_oids.oid[i];
879 - /*
880 - * When reaching here, it means remote-object-info can retrieve
881 - * information from server without downloading them.
882 - */
883 - if (remote_object_info[i].sizep) {
884 - data->size = *remote_object_info[i].sizep;
885 - found = 1;
886 - }
887 -
888 - if (remote_object_info[i].typep) {
889 - data->type = *remote_object_info[i].typep;
890 - found = 1;
891 - }
892 -
893 - if (!found && object_info_options.nr > 0) {
894 - report_object_status(opt, oid_to_hex(&data->oid),
895 - &data->oid, "missing");
896 - continue;
897 - }
898 -
899 - opt->batch_mode = BATCH_MODE_INFO;
900 - data->is_remote = 1;
901 - batch_object_write(argv[i + 1], output, opt, data, NULL, 0);
902 - data->is_remote = 0;
903 - }
904 - data->skip_object_info = 0;
905 -
906 -cleanup:
907 - for (size_t i = 0; i < object_info_oids.nr; i++)
908 - free_object_info_contents(&remote_object_info[i]);
909 - string_list_clear(&object_info_options, 0);
910 - free(line_to_split);
911 - free(argv);
912 - free(remote_object_info);
913 - oid_array_clear(&object_info_oids);
914 -}
915 -
720 static void dispatch_calls(struct batch_options *opt,
721 struct strbuf *output,
722 struct expand_data *data,
723 struct queued_cmd *cmd,
920 - size_t nr)
724 + int nr)
725 {
726 + int i;
727 +
728 if (!opt->buffer_output)
729 die(_("flush is only for --buffer mode"));
730
925 - for (size_t i = 0; i < nr; i++)
731 + for (i = 0; i < nr; i++)
732 cmd[i].fn(opt, cmd[i].line, output, data);
733
734 fflush(stdout);
@@ -930,7 +736,9 @@ static void dispatch_calls(struct batch_options *opt,
736
737 static void free_cmds(struct queued_cmd *cmd, size_t *nr)
738 {
933 - for (size_t i = 0; i < *nr; i++)
739 + size_t i;
740 +
741 + for (i = 0; i < *nr; i++)
742 FREE_AND_NULL(cmd[i].line);
743
744 *nr = 0;
@@ -944,9 +752,8 @@ static const struct parse_cmd {
752 } commands[] = {
753 { "contents", parse_cmd_contents, 1 },
754 { "info", parse_cmd_info, 1 },
947 - { "mailmap", parse_cmd_mailmap, 1 },
948 - { "remote-object-info", parse_cmd_remote_object_info, 1 },
755 { "flush", NULL, 0 },
756 + { "mailmap", parse_cmd_mailmap, 1 },
757 };
758
759 static void batch_objects_command(struct batch_options *opt,
@@ -958,6 +765,7 @@ static void batch_objects_command(struct batch_options *opt,
765 size_t alloc = 0, nr = 0;
766
767 while (strbuf_getdelim_strip_crlf(&input, stdin, opt->input_delim) != EOF) {
768 + int i;
769 const struct parse_cmd *cmd = NULL;
770 const char *p = NULL, *cmd_end;
771 struct queued_cmd call = {0};
@@ -967,7 +775,7 @@ static void batch_objects_command(struct batch_options *opt,
775 if (isspace(*input.buf))
776 die(_("whitespace before command: '%s'"), input.buf);
777
970 - for (size_t i = 0; i < ARRAY_SIZE(commands); i++) {
778 + for (i = 0; i < ARRAY_SIZE(commands); i++) {
779 if (!skip_prefix(input.buf, commands[i].name, &cmd_end))
780 continue;
781
@@ -1226,7 +1034,6 @@ static int batch_objects(struct batch_options *opt)
1034 cleanup:
1035 strbuf_release(&input);
1036 strbuf_release(&output);
1229 - string_list_clear(&data.remote_allowed_atoms, 0);
1037 cfg->warn_on_object_refname_ambiguity = save_warning;
1038 return retval;
1039 }
connect.c
-34
@@ -709,40 +709,6 @@ int server_supports(const char *feature)
709 return !!server_feature_value(feature, NULL);
710 }
711
712 -void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
713 - const struct string_list *server_options)
714 -{
715 - const char *hash_name;
716 - int advertise_sid = 0;
717 -
718 - repo_config_get_bool(the_repository, "transfer.advertisesid", &advertise_sid);
719 -
720 - ensure_server_supports_v2(command);
721 - packet_buf_write(req_buf, "command=%s", command);
722 - if (server_supports_v2("agent"))
723 - packet_buf_write(req_buf, "agent=%s", git_user_agent_sanitized());
724 - if (advertise_sid && server_supports_v2("session-id"))
725 - packet_buf_write(req_buf, "session-id=%s", trace2_session_id());
726 - if (server_options && server_options->nr) {
727 - ensure_server_supports_v2("server-option");
728 - for (size_t i = 0; i < server_options->nr; i++)
729 - packet_buf_write(req_buf, "server-option=%s",
730 - server_options->items[i].string);
731 - }
732 -
733 - if (server_feature_v2("object-format", &hash_name)) {
734 - const unsigned int hash_algo = hash_algo_by_name(hash_name);
735 - if (hash_algo_by_ptr(the_hash_algo) != hash_algo)
736 - die(_("mismatched algorithms: client %s; server %s"),
737 - the_hash_algo->name, hash_name);
738 - packet_buf_write(req_buf, "object-format=%s", the_hash_algo->name);
739 - } else if (hash_algo_by_ptr(the_hash_algo) != GIT_HASH_SHA1_LEGACY) {
740 - die(_("the server does not support algorithm '%s'"),
741 - the_hash_algo->name);
742 - }
743 - packet_buf_delim(req_buf);
744 -}
745 -
712 static const char *url_scheme_name(enum url_scheme scheme)
713 {
714 switch (scheme) {
connect.h
-8
@@ -34,12 +34,4 @@ void check_stateless_delimiter(int stateless_rpc,
34 struct packet_reader *reader,
35 const char *error);
36
37 -struct string_list;
38 -/*
39 - * Writes a command along with the requested server capabilities/features into a
40 - * request buffer.
41 - */
42 -void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
43 - const struct string_list *server_options);
44 -
37 #endif
fetch-object-info.c deleted
-129
@@ -1,129 +0,0 @@
1 -#include "git-compat-util.h"
2 -#include "gettext.h"
3 -#include "hex.h"
4 -#include "pkt-line.h"
5 -#include "connect.h"
6 -#include "oid-array.h"
7 -#include "odb.h"
8 -#include "fetch-object-info.h"
9 -#include "string-list.h"
10 -
11 -/* Sends object-info command and its arguments into the request buffer. */
12 -static void send_object_info_request(const int fd_out, struct object_info_args *args)
13 -{
14 - struct strbuf req_buf = STRBUF_INIT;
15 -
16 - write_command_and_capabilities(&req_buf, "object-info", args->server_options);
17 -
18 - if (unsorted_string_list_has_string(args->object_info_options, "size"))
19 - packet_buf_write(&req_buf, "size");
20 - else
21 - BUG("only size should be in object_info_options");
22 -
23 - if (args->oids)
24 - for (size_t i = 0; i < args->oids->nr; i++)
25 - packet_buf_write(&req_buf, "oid %s", oid_to_hex(&args->oids->oid[i]));
26 -
27 - packet_buf_flush(&req_buf);
28 - if (write_in_full(fd_out, req_buf.buf, req_buf.len) < 0)
29 - die_errno(_("unable to write request to remote"));
30 -
31 - strbuf_release(&req_buf);
32 -}
33 -
34 -static size_t parse_object_size(const char *s, size_t *res)
35 -{
36 - uintmax_t uim;
37 -
38 - if (!s[0] || s[strspn(s, "0123456789")])
39 - return -1;
40 - errno = 0;
41 - uim = strtoumax(s, NULL, 10);
42 - if (errno || uim > SIZE_MAX)
43 - return -1;
44 - *res = uim;
45 - return 0;
46 -}
47 -
48 -int fetch_object_info(const enum protocol_version version, struct object_info_args *args,
49 - struct packet_reader *reader, struct object_info *object_info_data,
50 - const int stateless_rpc, const int fd_out)
51 -{
52 - int size_index = -1;
53 -
54 - switch (version) {
55 - case protocol_v2:
56 - if (!server_supports_v2("object-info"))
57 - die(_("object-info capability is not enabled on the server"));
58 - /*
59 - * When removing an element from the list it gets swapped by the
60 - * last element, iterate backwards to prevent elements skipping
61 - * evaluation.
62 - *
63 - * object_info_options->nr can be safely casted without overflow
64 - * beacuse the number of options is a small known number (the
65 - * supported placeholders which currently are size and type).
66 - */
67 - for (int i = (int)args->object_info_options->nr - 1; i >= 0; i--)
68 - if (!server_supports_feature("object-info",
69 - args->object_info_options->items[i].string, 0))
70 - unsorted_string_list_delete_item(args->object_info_options, i, 0);
71 - /*
72 - * If no options are left after the filtering, avoid unnecessary
73 - * request to the server.
74 - */
75 - if (!args->object_info_options->nr)
76 - return 0;
77 -
78 - send_object_info_request(fd_out, args);
79 - break;
80 - case protocol_v1:
81 - case protocol_v0:
82 - die(_("unsupported protocol version. expected v2"));
83 - case protocol_unknown_version:
84 - BUG("unknown protocol version");
85 - }
86 -
87 - for (size_t i = 0; i < args->object_info_options->nr; i++) {
88 - if (packet_reader_read(reader) != PACKET_READ_NORMAL) {
89 - check_stateless_delimiter(stateless_rpc, reader,
90 - "stateless delimiter expected");
91 - return -1;
92 - }
93 -
94 - if (!string_list_has_string(args->object_info_options, reader->line))
95 - return -1;
96 -
97 - if (!strcmp(reader->line, "size")) {
98 - size_index = i;
99 - for (size_t j = 0; j < args->oids->nr; j++)
100 - object_info_data[j].sizep = xcalloc(1, sizeof(*object_info_data[j].sizep));
101 - } else {
102 - BUG("only size is supported");
103 - }
104 - }
105 -
106 - for (size_t i = 0; packet_reader_read(reader) == PACKET_READ_NORMAL && i < args->oids->nr; i++) {
107 - struct string_list object_info_values = STRING_LIST_INIT_DUP;
108 -
109 - string_list_split(&object_info_values, reader->line, " ", -1);
110 - if (size_index >= 0) {
111 - if (!strcmp(object_info_values.items[1 + size_index].string, "")) {
112 - FREE_AND_NULL(object_info_data[i].sizep);
113 - string_list_clear(&object_info_values, 0);
114 - continue;
115 - }
116 -
117 - if (parse_object_size(object_info_values.items[1 + size_index].string,
118 - object_info_data[i].sizep))
119 - die("object-info: ref %s has invalid size %s",
120 - object_info_values.items[0].string,
121 - object_info_values.items[1 + size_index].string);
122 - }
123 -
124 - string_list_clear(&object_info_values, 0);
125 - }
126 - check_stateless_delimiter(stateless_rpc, reader, "stateless delimiter expected");
127 -
128 - return 0;
129 -}
fetch-object-info.h deleted
-22
@@ -1,22 +0,0 @@
1 -#ifndef FETCH_OBJECT_INFO_H
2 -#define FETCH_OBJECT_INFO_H
3 -
4 -#include "pkt-line.h"
5 -#include "protocol.h"
6 -#include "odb.h"
7 -
8 -struct object_info_args {
9 - struct string_list *object_info_options;
10 - const struct string_list *server_options;
11 - struct oid_array *oids;
12 -};
13 -
14 -/*
15 - * Sends git-cat-file object-info command into the request buf and read the
16 - * results from packets.
17 - */
18 -int fetch_object_info(enum protocol_version version, struct object_info_args *args,
19 - struct packet_reader *reader, struct object_info *object_info_data,
20 - int stateless_rpc, int fd_out);
21 -
22 -#endif /* FETCH_OBJECT_INFO_H */
fetch-pack.c
+46 -12
@@ -49,6 +49,7 @@ static int fetch_fsck_objects = -1;
49 static int transfer_fsck_objects = -1;
50 static int agent_supported;
51 static int server_supports_filtering;
52 +static int advertise_sid;
53 static struct shallow_lock shallow_lock;
54 static const char *alternate_shallow_file;
55 static struct strbuf fsck_msg_types = STRBUF_INIT;
@@ -362,9 +363,6 @@ static int find_common(struct fetch_negotiator *negotiator,
363 size_t state_len = 0;
364 struct packet_reader reader;
365 struct oidset negotiation_include_oids = OIDSET_INIT;
365 - int advertise_sid = 0;
366 -
367 - repo_config_get_bool(the_repository, "transfer.advertisesid", &advertise_sid);
366
367 if (args->stateless_rpc && multi_ack == 1)
368 die(_("the option '%s' requires '%s'"), "--stateless-rpc", "multi_ack_detailed");
@@ -416,7 +414,7 @@ static int find_common(struct fetch_negotiator *negotiator,
414 if (deepen_not_ok) strbuf_addstr(&c, " deepen-not");
415 if (agent_supported) strbuf_addf(&c, " agent=%s",
416 git_user_agent_sanitized());
419 - if (advertise_sid && server_supports("session-id"))
417 + if (advertise_sid)
418 strbuf_addf(&c, " session-id=%s", trace2_session_id());
419 if (args->filter_options.choice)
420 strbuf_addstr(&c, " filter");
@@ -1162,6 +1160,9 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
1160 (int)agent_len, agent_feature);
1161 }
1162
1163 + if (!server_supports("session-id"))
1164 + advertise_sid = 0;
1165 +
1166 if (server_supports("shallow"))
1167 print_verbose(args, _("Server supports %s"), "shallow");
1168 else if (args->depth > 0 || is_repository_shallow(r))
@@ -1375,6 +1376,38 @@ static int add_haves(struct fetch_negotiator *negotiator,
1376 return haves_added;
1377 }
1378
1379 +static void write_fetch_command_and_capabilities(struct strbuf *req_buf,
1380 + const struct string_list *server_options)
1381 +{
1382 + const char *hash_name;
1383 +
1384 + ensure_server_supports_v2("fetch");
1385 + packet_buf_write(req_buf, "command=fetch");
1386 + if (server_supports_v2("agent"))
1387 + packet_buf_write(req_buf, "agent=%s", git_user_agent_sanitized());
1388 + if (advertise_sid && server_supports_v2("session-id"))
1389 + packet_buf_write(req_buf, "session-id=%s", trace2_session_id());
1390 + if (server_options && server_options->nr) {
1391 + int i;
1392 + ensure_server_supports_v2("server-option");
1393 + for (i = 0; i < server_options->nr; i++)
1394 + packet_buf_write(req_buf, "server-option=%s",
1395 + server_options->items[i].string);
1396 + }
1397 +
1398 + if (server_feature_v2("object-format", &hash_name)) {
1399 + int hash_algo = hash_algo_by_name(hash_name);
1400 + if (hash_algo_by_ptr(the_hash_algo) != hash_algo)
1401 + die(_("mismatched algorithms: client %s; server %s"),
1402 + the_hash_algo->name, hash_name);
1403 + packet_buf_write(req_buf, "object-format=%s", the_hash_algo->name);
1404 + } else if (hash_algo_by_ptr(the_hash_algo) != GIT_HASH_SHA1_LEGACY) {
1405 + die(_("the server does not support algorithm '%s'"),
1406 + the_hash_algo->name);
1407 + }
1408 + packet_buf_delim(req_buf);
1409 +}
1410 +
1411 static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
1412 struct fetch_pack_args *args,
1413 const struct ref *wants, struct oidset *common,
@@ -1386,7 +1419,7 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
1419 int done_sent = 0;
1420 struct strbuf req_buf = STRBUF_INIT;
1421
1389 - write_command_and_capabilities(&req_buf, "fetch", args->server_options);
1422 + write_fetch_command_and_capabilities(&req_buf, args->server_options);
1423
1424 if (args->use_thin_pack)
1425 packet_buf_write(&req_buf, "thin-pack");
@@ -1735,18 +1768,18 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
1768 reader.me = "fetch-pack";
1769 }
1770
1738 - /* v2 supports these by default */
1739 - allow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1;
1740 - use_sideband = 2;
1741 - if (args->depth > 0 || args->deepen_since || args->deepen_not)
1742 - args->deepen = 1;
1743 -
1771 while (state != FETCH_DONE) {
1772 switch (state) {
1773 case FETCH_CHECK_LOCAL:
1774 sort_ref_list(&ref, ref_compare_name);
1775 QSORT(sought, nr_sought, cmp_ref_by_name);
1776
1777 + /* v2 supports these by default */
1778 + allow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1;
1779 + use_sideband = 2;
1780 + if (args->depth > 0 || args->deepen_since || args->deepen_not)
1781 + args->deepen = 1;
1782 +
1783 /* Filter 'ref' by 'sought' and those that aren't local */
1784 mark_complete_and_common_ref(negotiator, args, &ref);
1785 filter_refs(args, &ref, sought, nr_sought);
@@ -1966,6 +1999,7 @@ static void fetch_pack_config(void)
1999 repo_config_get_bool(the_repository, "repack.usedeltabaseoffset", &prefer_ofs_delta);
2000 repo_config_get_bool(the_repository, "fetch.fsckobjects", &fetch_fsck_objects);
2001 repo_config_get_bool(the_repository, "transfer.fsckobjects", &transfer_fsck_objects);
2002 + repo_config_get_bool(the_repository, "transfer.advertisesid", &advertise_sid);
2003 if (!uri_protocols.nr) {
2004 char *str;
2005
@@ -2253,7 +2287,7 @@ void negotiate_using_fetch(const struct oid_array *negotiation_restrict_tips,
2287 the_repository, "%d",
2288 negotiation_round);
2289 strbuf_reset(&req_buf);
2256 - write_command_and_capabilities(&req_buf, "fetch", server_options);
2290 + write_fetch_command_and_capabilities(&req_buf, server_options);
2291
2292 packet_buf_write(&req_buf, "wait-for-done");
2293
fetch-pack.h
-1
@@ -16,7 +16,6 @@ struct fetch_pack_args {
16 const struct string_list *deepen_not;
17 struct list_objects_filter_options filter_options;
18 const struct string_list *server_options;
19 - struct object_info *object_info_data;
19
20 /*
21 * If not NULL, during packfile negotiation, fetch-pack will send "have"
meson.build
-1
@@ -375,7 +375,6 @@ libgit_sources = [
375 'exec-cmd.c',
376 'fetch-negotiator.c',
377 'fetch-pack.c',
378 - 'fetch-object-info.c',
378 'fmt-merge-msg.c',
379 'fsck.c',
380 'fsmonitor.c',
object-file.c
-10
@@ -1695,13 +1695,3 @@ struct odb_transaction *odb_transaction_files_begin(struct odb_source *source)
1695
1696 return &transaction->base;
1697 }
1698 -
1699 -void free_object_info_contents(struct object_info *object_info)
1700 -{
1701 - if (!object_info)
1702 - return;
1703 - free(object_info->typep);
1704 - free(object_info->sizep);
1705 - free(object_info->disk_sizep);
1706 - free(object_info->delta_base_oid);
1707 -}
odb.h
-3
@@ -617,7 +617,4 @@ void parse_alternates(const char *string,
617 const char *relative_base,
618 struct strvec *out);
619
620 -/* Free pointers inside of object_info, but not object_info itself */
621 -void free_object_info_contents(struct object_info *object_info);
622 -
620 #endif /* ODB_H */
serve.c
+1 -4
@@ -89,7 +89,7 @@ static void session_id_receive(struct repository *r UNUSED,
89 trace2_data_string("transfer", NULL, "client-sid", client_sid);
90 }
91
92 -static int object_info_advertise(struct repository *r, struct strbuf *value)
92 +static int object_info_advertise(struct repository *r, struct strbuf *value UNUSED)
93 {
94 if (advertise_object_info == -1 &&
95 repo_config_get_bool(r, "transfer.advertiseobjectinfo",
@@ -97,9 +97,6 @@ static int object_info_advertise(struct repository *r, struct strbuf *value)
97 /* disabled by default */
98 advertise_object_info = 0;
99 }
100 - /* Currently only size is supported */
101 - if (value && advertise_object_info)
102 - strbuf_addstr(value, "size");
100 return advertise_object_info;
101 }
102
t/lib-cat-file.sh deleted
-16
@@ -1,16 +0,0 @@
1 -# Library of git-cat-file related test functions.
2 -
3 -# Print a string without a trailing newline.
4 -echo_without_newline () {
5 - printf '%s' "$*"
6 -}
7 -
8 -# Print a string without newlines and replace them with a NULL character (\0).
9 -echo_without_newline_nul () {
10 - echo_without_newline "$@" | tr '\n' '\0'
11 -}
12 -
13 -# Calculate the length of a string.
14 -strlen () {
15 - echo_without_newline "$1" | wc -c | sed -e 's/^ *//'
16 -}
t/meson.build
-1
@@ -171,7 +171,6 @@ integration_tests = [
171 't1014-read-tree-confusing.sh',
172 't1015-read-index-unmerged.sh',
173 't1016-compatObjectFormat.sh',
174 - 't1017-cat-file-remote-object-info.sh',
174 't1020-subdirectory.sh',
175 't1022-read-tree-partial-clone.sh',
176 't1050-large.sh',
t/t1006-cat-file.sh
+12 -1
@@ -4,7 +4,6 @@ test_description='git cat-file'
4
5 . ./test-lib.sh
6 . "$TEST_DIRECTORY/lib-loose.sh"
7 -. "$TEST_DIRECTORY"/lib-cat-file.sh
7
8 test_cmdmode_usage () {
9 test_expect_code 129 "$@" 2>err &&
@@ -100,6 +99,18 @@ do
99 '
100 done
101
102 +echo_without_newline () {
103 + printf '%s' "$*"
104 +}
105 +
106 +echo_without_newline_nul () {
107 + echo_without_newline "$@" | tr '\n' '\0'
108 +}
109 +
110 +strlen () {
111 + echo_without_newline "$1" | wc -c | sed -e 's/^ *//'
112 +}
113 +
114 run_tests () {
115 type=$1
116 object_name="$2"
t/t1017-cat-file-remote-object-info.sh deleted
-699
@@ -1,699 +0,0 @@
1 -#!/bin/sh
2 -
3 -test_description='git cat-file --batch-command with remote-object-info command'
4 -
5 -GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6 -export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7 -
8 -. ./test-lib.sh
9 -. "$TEST_DIRECTORY"/lib-cat-file.sh
10 -
11 -hello_content="Hello World"
12 -hello_size=$(strlen "$hello_content")
13 -hello_oid=$(echo_without_newline "$hello_content" | git hash-object --stdin)
14 -hello_short_oid=$(git rev-parse --short "$hello_oid")
15 -
16 -unstored_content="Hello Git"
17 -unstored_oid=$(echo_without_newline "$unstored_content" | git hash-object --stdin)
18 -
19 -# This is how we get 13:
20 -# 13 = <file mode> + <a_space> + <file name> + <a_null>, where
21 -# file mode is 100644, which is 6 characters;
22 -# file name is hello, which is 5 characters
23 -# a space is 1 character and a null is 1 character
24 -tree_size=$(($(test_oid rawsz) + 13))
25 -
26 -commit_message="Initial commit"
27 -
28 -# This is how we get 137:
29 -# 137 = <tree header> + <a_space> + <a newline> +
30 -# <Author line> + <a newline> +
31 -# <Committer line> + <a newline> +
32 -# <a newline> +
33 -# <commit message length>
34 -# An easier way to calculate is: 1. use `git cat-file commit <commit hash> | wc -c`,
35 -# to get 177, 2. then deduct 40 hex characters to get 137
36 -commit_size=$(($(test_oid hexsz) + 137))
37 -
38 -tag_header_without_oid="type blob
39 -tag hellotag
40 -tagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
41 -tag_header_without_timestamp="object $hello_oid
42 -$tag_header_without_oid"
43 -tag_description="This is a tag"
44 -tag_content="$tag_header_without_timestamp 0 +0000
45 -
46 -$tag_description"
47 -
48 -tag_oid=$(echo_without_newline "$tag_content" | git hash-object -t tag --stdin -w)
49 -tag_size=$(strlen "$tag_content")
50 -
51 -set_transport_variables () {
52 - hello_oid=$(echo_without_newline "$hello_content" | git hash-object --stdin)
53 - tree_oid=$(git -C "$1" write-tree)
54 - commit_oid=$(echo_without_newline "$commit_message" | git -C "$1" commit-tree $tree_oid)
55 - tag_oid=$(echo_without_newline "$tag_content" | git -C "$1" hash-object -t tag --stdin -w)
56 - tag_size=$(strlen "$tag_content")
57 -}
58 -
59 -# This section tests --batch-command with remote-object-info command
60 -# Since "%(objecttype)" is currently not supported by the command remote-object-info ,
61 -# the filters are set to "%(objectname) %(objectsize)" in some test cases.
62 -
63 -# Test --batch-command remote-object-info with 'git://' transport with
64 -# transfer.advertiseobjectinfo set to true, i.e. server has object-info capability
65 -. "$TEST_DIRECTORY"/lib-git-daemon.sh
66 -start_git_daemon --export-all --enable=receive-pack
67 -daemon_parent=$GIT_DAEMON_DOCUMENT_ROOT_PATH/parent
68 -
69 -test_expect_success 'create repo to be served by git-daemon' '
70 - git init "$daemon_parent" &&
71 - echo_without_newline "$hello_content" > $daemon_parent/hello &&
72 - git -C "$daemon_parent" update-index --add hello &&
73 - git -C "$daemon_parent" config transfer.advertiseobjectinfo true &&
74 - git clone "$GIT_DAEMON_URL/parent" -n "$daemon_parent/daemon_client_empty"
75 -'
76 -
77 -test_expect_success 'batch-command remote-object-info git://' '
78 - (
79 - set_transport_variables "$daemon_parent" &&
80 - cd "$daemon_parent/daemon_client_empty" &&
81 -
82 - # These results prove remote-object-info can get object info from the remote
83 - echo "$hello_oid $hello_size" >expect &&
84 - echo "$tree_oid $tree_size" >>expect &&
85 - echo "$commit_oid $commit_size" >>expect &&
86 - echo "$tag_oid $tag_size" >>expect &&
87 -
88 - # These results prove remote-object-info did not download objects from the remote
89 - echo "$hello_oid missing" >>expect &&
90 - echo "$tree_oid missing" >>expect &&
91 - echo "$commit_oid missing" >>expect &&
92 - echo "$tag_oid missing" >>expect &&
93 -
94 - git cat-file --batch-command="%(objectname) %(objectsize)" >actual <<-EOF &&
95 - remote-object-info "$GIT_DAEMON_URL/parent" $hello_oid
96 - remote-object-info "$GIT_DAEMON_URL/parent" $tree_oid
97 - remote-object-info "$GIT_DAEMON_URL/parent" $commit_oid
98 - remote-object-info "$GIT_DAEMON_URL/parent" $tag_oid
99 - info $hello_oid
100 - info $tree_oid
101 - info $commit_oid
102 - info $tag_oid
103 - EOF
104 - test_cmp expect actual
105 - )
106 -'
107 -
108 -test_expect_success 'batch-command remote-object-info git:// multiple sha1 per line' '
109 - (
110 - set_transport_variables "$daemon_parent" &&
111 - cd "$daemon_parent/daemon_client_empty" &&
112 -
113 - # These results prove remote-object-info can get object info from the remote
114 - echo "$hello_oid $hello_size" >expect &&
115 - echo "$tree_oid $tree_size" >>expect &&
116 - echo "$commit_oid $commit_size" >>expect &&
117 - echo "$tag_oid $tag_size" >>expect &&
118 -
119 - # These results prove remote-object-info did not download objects from the remote
120 - echo "$hello_oid missing" >>expect &&
121 - echo "$tree_oid missing" >>expect &&
122 - echo "$commit_oid missing" >>expect &&
123 - echo "$tag_oid missing" >>expect &&
124 -
125 - git cat-file --batch-command="%(objectname) %(objectsize)" >actual <<-EOF &&
126 - remote-object-info "$GIT_DAEMON_URL/parent" $hello_oid $tree_oid $commit_oid $tag_oid
127 - info $hello_oid
128 - info $tree_oid
129 - info $commit_oid
130 - info $tag_oid
131 - EOF
132 - test_cmp expect actual
133 - )
134 -'
135 -
136 -test_expect_success 'batch-command remote-object-info git:// default filter' '
137 - (
138 - set_transport_variables "$daemon_parent" &&
139 - cd "$daemon_parent/daemon_client_empty" &&
140 -
141 - echo "$hello_oid $hello_size" >expect &&
142 - echo "$tree_oid $tree_size" >>expect &&
143 - echo "$commit_oid $commit_size" >>expect &&
144 - echo "$tag_oid $tag_size" >>expect &&
145 - GIT_TRACE_PACKET=1 git cat-file --batch-command >actual <<-EOF &&
146 - remote-object-info "$GIT_DAEMON_URL/parent" $hello_oid $tree_oid
147 - remote-object-info "$GIT_DAEMON_URL/parent" $commit_oid $tag_oid
148 - EOF
149 - test_cmp expect actual
150 - )
151 -'
152 -
153 -test_expect_success 'batch-command --buffer remote-object-info git://' '
154 - (
155 - set_transport_variables "$daemon_parent" &&
156 - cd "$daemon_parent/daemon_client_empty" &&
157 -
158 - # These results prove remote-object-info can get object info from the remote
159 - echo "$hello_oid $hello_size" >expect &&
160 - echo "$tree_oid $tree_size" >>expect &&
161 - echo "$commit_oid $commit_size" >>expect &&
162 - echo "$tag_oid $tag_size" >>expect &&
163 -
164 - # These results prove remote-object-info did not download objects from the remote
165 - echo "$hello_oid missing" >>expect &&
166 - echo "$tree_oid missing" >>expect &&
167 - echo "$commit_oid missing" >>expect &&
168 - echo "$tag_oid missing" >>expect &&
169 -
170 - git cat-file --batch-command="%(objectname) %(objectsize)" --buffer >actual <<-EOF &&
171 - remote-object-info "$GIT_DAEMON_URL/parent" $hello_oid $tree_oid
172 - remote-object-info "$GIT_DAEMON_URL/parent" $commit_oid $tag_oid
173 - info $hello_oid
174 - info $tree_oid
175 - info $commit_oid
176 - info $tag_oid
177 - flush
178 - EOF
179 - test_cmp expect actual
180 - )
181 -'
182 -
183 -test_expect_success 'batch-command -Z remote-object-info git:// default filter' '
184 - (
185 - set_transport_variables "$daemon_parent" &&
186 - cd "$daemon_parent/daemon_client_empty" &&
187 -
188 - printf "%s\0" "$hello_oid $hello_size" >expect &&
189 - printf "%s\0" "$tree_oid $tree_size" >>expect &&
190 - printf "%s\0" "$commit_oid $commit_size" >>expect &&
191 - printf "%s\0" "$tag_oid $tag_size" >>expect &&
192 -
193 - printf "%s\0" "$hello_oid missing" >>expect &&
194 - printf "%s\0" "$tree_oid missing" >>expect &&
195 - printf "%s\0" "$commit_oid missing" >>expect &&
196 - printf "%s\0" "$tag_oid missing" >>expect &&
197 -
198 - batch_input="remote-object-info $GIT_DAEMON_URL/parent $hello_oid $tree_oid
199 -remote-object-info $GIT_DAEMON_URL/parent $commit_oid $tag_oid
200 -info $hello_oid
201 -info $tree_oid
202 -info $commit_oid
203 -info $tag_oid
204 -" &&
205 - echo_without_newline_nul "$batch_input" >commands_null_delimited &&
206 -
207 - git cat-file --batch-command -Z < commands_null_delimited >actual &&
208 - test_cmp expect actual
209 - )
210 -'
211 -
212 -test_expect_success 'remote-object-info does not support short oids' '
213 - (
214 - set_transport_variables "$daemon_parent" &&
215 - cd "$daemon_parent/daemon_client_empty" &&
216 -
217 - test_must_fail git cat-file --batch-command 2>err <<-EOF &&
218 - remote-object-info $GIT_DAEMON_URL/parent $hello_short_oid
219 - EOF
220 - test_grep "does not support short oids" err
221 - )
222 -'
223 -
224 -test_expect_success 'remote-object-info does not die on missing oid like info' '
225 - (
226 - set_transport_variables "$daemon_parent" &&
227 - cd "$daemon_parent/daemon_client_empty" &&
228 -
229 - git cat-file --batch-command >local <<-EOF &&
230 - info $unstored_oid
231 - EOF
232 - git cat-file --batch-command >remote <<-EOF &&
233 - remote-object-info $GIT_DAEMON_URL/parent $unstored_oid
234 - EOF
235 - test_cmp local remote
236 - )
237 -'
238 -
239 -# This tests depends on %(objecttype) not being supported yet, once supported
240 -# it needs to be updated.
241 -test_expect_success 'unsupported placeholder on remote returns empty string' '
242 - (
243 - set_transport_variables "$daemon_parent" &&
244 - cd "$daemon_parent/daemon_client_empty" &&
245 -
246 - echo "" >expect &&
247 - git cat-file --batch-command="%(objecttype)" >actual <<-EOF &&
248 - remote-object-info "$GIT_DAEMON_URL/parent" $hello_oid
249 - EOF
250 - test_cmp expect actual
251 - )
252 -'
253 -
254 -# Test --batch-command remote-object-info with 'git://' and
255 -# transfer.advertiseobjectinfo set to false, i.e. server does not have object-info capability
256 -test_expect_success 'batch-command remote-object-info git:// fails when transfer.advertiseobjectinfo=false' '
257 - (
258 - git -C "$daemon_parent" config transfer.advertiseobjectinfo false &&
259 - set_transport_variables "$daemon_parent" &&
260 -
261 - test_must_fail git cat-file --batch-command="%(objectname) %(objectsize)" 2>err <<-EOF &&
262 - remote-object-info $GIT_DAEMON_URL/parent $hello_oid $tree_oid $commit_oid $tag_oid
263 - EOF
264 - test_grep "object-info capability is not enabled on the server" err &&
265 -
266 - # revert server state back
267 - git -C "$daemon_parent" config transfer.advertiseobjectinfo true
268 -
269 - )
270 -'
271 -
272 -stop_git_daemon
273 -
274 -# Test --batch-command remote-object-info with 'file://' transport with
275 -# transfer.advertiseobjectinfo set to true, i.e. server has object-info capability
276 -# shellcheck disable=SC2016
277 -test_expect_success 'create repo to be served by file:// transport' '
278 - git init server &&
279 - git -C server config protocol.version 2 &&
280 - git -C server config transfer.advertiseobjectinfo true &&
281 - echo_without_newline "$hello_content" > server/hello &&
282 - git -C server update-index --add hello &&
283 - git clone -n "file://$(pwd)/server" file_client_empty
284 -'
285 -
286 -test_expect_success 'batch-command remote-object-info file://' '
287 - (
288 - set_transport_variables "server" &&
289 - server_path="$(pwd)/server" &&
290 - cd file_client_empty &&
291 -
292 - # These results prove remote-object-info can get object info from the remote
293 - echo "$hello_oid $hello_size" >expect &&
294 - echo "$tree_oid $tree_size" >>expect &&
295 - echo "$commit_oid $commit_size" >>expect &&
296 - echo "$tag_oid $tag_size" >>expect &&
297 -
298 - # These results prove remote-object-info did not download objects from the remote
299 - echo "$hello_oid missing" >>expect &&
300 - echo "$tree_oid missing" >>expect &&
301 - echo "$commit_oid missing" >>expect &&
302 - echo "$tag_oid missing" >>expect &&
303 -
304 - git cat-file --batch-command="%(objectname) %(objectsize)" >actual <<-EOF &&
305 - remote-object-info "file://${server_path}" $hello_oid
306 - remote-object-info "file://${server_path}" $tree_oid
307 - remote-object-info "file://${server_path}" $commit_oid
308 - remote-object-info "file://${server_path}" $tag_oid
309 - info $hello_oid
310 - info $tree_oid
311 - info $commit_oid
312 - info $tag_oid
313 - EOF
314 - test_cmp expect actual
315 - )
316 -'
317 -
318 -test_expect_success 'batch-command remote-object-info file:// multiple sha1 per line' '
319 - (
320 - set_transport_variables "server" &&
321 - server_path="$(pwd)/server" &&
322 - cd file_client_empty &&
323 -
324 - # These results prove remote-object-info can get object info from the remote
325 - echo "$hello_oid $hello_size" >expect &&
326 - echo "$tree_oid $tree_size" >>expect &&
327 - echo "$commit_oid $commit_size" >>expect &&
328 - echo "$tag_oid $tag_size" >>expect &&
329 -
330 - # These results prove remote-object-info did not download objects from the remote
331 - echo "$hello_oid missing" >>expect &&
332 - echo "$tree_oid missing" >>expect &&
333 - echo "$commit_oid missing" >>expect &&
334 - echo "$tag_oid missing" >>expect &&
335 -
336 -
337 - git cat-file --batch-command="%(objectname) %(objectsize)" >actual <<-EOF &&
338 - remote-object-info "file://${server_path}" $hello_oid $tree_oid $commit_oid $tag_oid
339 - info $hello_oid
340 - info $tree_oid
341 - info $commit_oid
342 - info $tag_oid
343 - EOF
344 - test_cmp expect actual
345 - )
346 -'
347 -
348 -test_expect_success 'batch-command --buffer remote-object-info file://' '
349 - (
350 - set_transport_variables "server" &&
351 - server_path="$(pwd)/server" &&
352 - cd file_client_empty &&
353 -
354 - # These results prove remote-object-info can get object info from the remote
355 - echo "$hello_oid $hello_size" >expect &&
356 - echo "$tree_oid $tree_size" >>expect &&
357 - echo "$commit_oid $commit_size" >>expect &&
358 - echo "$tag_oid $tag_size" >>expect &&
359 -
360 - # These results prove remote-object-info did not download objects from the remote
361 - echo "$hello_oid missing" >>expect &&
362 - echo "$tree_oid missing" >>expect &&
363 - echo "$commit_oid missing" >>expect &&
364 - echo "$tag_oid missing" >>expect &&
365 -
366 - git cat-file --batch-command="%(objectname) %(objectsize)" --buffer >actual <<-EOF &&
367 - remote-object-info "file://${server_path}" $hello_oid $tree_oid
368 - remote-object-info "file://${server_path}" $commit_oid $tag_oid
369 - info $hello_oid
370 - info $tree_oid
371 - info $commit_oid
372 - info $tag_oid
373 - flush
374 - EOF
375 - test_cmp expect actual
376 - )
377 -'
378 -
379 -test_expect_success 'batch-command remote-object-info file:// default filter' '
380 - (
381 - set_transport_variables "server" &&
382 - server_path="$(pwd)/server" &&
383 - cd file_client_empty &&
384 -
385 - echo "$hello_oid $hello_size" >expect &&
386 - echo "$tree_oid $tree_size" >>expect &&
387 - echo "$commit_oid $commit_size" >>expect &&
388 - echo "$tag_oid $tag_size" >>expect &&
389 -
390 - git cat-file --batch-command >actual <<-EOF &&
391 - remote-object-info "file://${server_path}" $hello_oid $tree_oid
392 - remote-object-info "file://${server_path}" $commit_oid $tag_oid
393 - EOF
394 - test_cmp expect actual
395 - )
396 -'
397 -
398 -test_expect_success 'batch-command -Z remote-object-info file:// default filter' '
399 - (
400 - set_transport_variables "server" &&
401 - server_path="$(pwd)/server" &&
402 - cd file_client_empty &&
403 -
404 - printf "%s\0" "$hello_oid $hello_size" >expect &&
405 - printf "%s\0" "$tree_oid $tree_size" >>expect &&
406 - printf "%s\0" "$commit_oid $commit_size" >>expect &&
407 - printf "%s\0" "$tag_oid $tag_size" >>expect &&
408 -
409 - printf "%s\0" "$hello_oid missing" >>expect &&
410 - printf "%s\0" "$tree_oid missing" >>expect &&
411 - printf "%s\0" "$commit_oid missing" >>expect &&
412 - printf "%s\0" "$tag_oid missing" >>expect &&
413 -
414 - batch_input="remote-object-info \"file://${server_path}\" $hello_oid $tree_oid
415 -remote-object-info \"file://${server_path}\" $commit_oid $tag_oid
416 -info $hello_oid
417 -info $tree_oid
418 -info $commit_oid
419 -info $tag_oid
420 -" &&
421 - echo_without_newline_nul "$batch_input" >commands_null_delimited &&
422 -
423 - git cat-file --batch-command -Z < commands_null_delimited >actual &&
424 - test_cmp expect actual
425 - )
426 -'
427 -
428 -# Test --batch-command remote-object-info with 'file://' and
429 -# transfer.advertiseobjectinfo set to false, i.e. server does not have object-info capability
430 -test_expect_success 'batch-command remote-object-info file:// fails when transfer.advertiseobjectinfo=false' '
431 - (
432 - set_transport_variables "server" &&
433 - server_path="$(pwd)/server" &&
434 - git -C "${server_path}" config transfer.advertiseobjectinfo false &&
435 -
436 - test_must_fail git cat-file --batch-command="%(objectname) %(objectsize)" 2>err <<-EOF &&
437 - remote-object-info "file://${server_path}" $hello_oid $tree_oid $commit_oid $tag_oid
438 - EOF
439 - test_grep "object-info capability is not enabled on the server" err &&
440 -
441 - # revert server state back
442 - git -C "${server_path}" config transfer.advertiseobjectinfo true
443 - )
444 -'
445 -
446 -# Test --batch-command remote-object-info with 'http://' transport with
447 -# transfer.advertiseobjectinfo set to true, i.e. server has object-info capability
448 -
449 -. "$TEST_DIRECTORY"/lib-httpd.sh
450 -start_httpd
451 -
452 -test_expect_success 'create repo to be served by http:// transport' '
453 - git init "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
454 - git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" config http.receivepack true &&
455 - git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" config transfer.advertiseobjectinfo true &&
456 - echo_without_newline "$hello_content" > $HTTPD_DOCUMENT_ROOT_PATH/http_parent/hello &&
457 - git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" update-index --add hello &&
458 - git clone "$HTTPD_URL/smart/http_parent" -n "$HTTPD_DOCUMENT_ROOT_PATH/http_client_empty"
459 -'
460 -
461 -test_expect_success 'batch-command remote-object-info http://' '
462 - (
463 - set_transport_variables "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
464 - cd "$HTTPD_DOCUMENT_ROOT_PATH/http_client_empty" &&
465 -
466 - # These results prove remote-object-info can get object info from the remote
467 - echo "$hello_oid $hello_size" >expect &&
468 - echo "$tree_oid $tree_size" >>expect &&
469 - echo "$commit_oid $commit_size" >>expect &&
470 - echo "$tag_oid $tag_size" >>expect &&
471 -
472 - # These results prove remote-object-info did not download objects from the remote
473 - echo "$hello_oid missing" >>expect &&
474 - echo "$tree_oid missing" >>expect &&
475 - echo "$commit_oid missing" >>expect &&
476 - echo "$tag_oid missing" >>expect &&
477 -
478 - git cat-file --batch-command="%(objectname) %(objectsize)" >actual <<-EOF &&
479 - remote-object-info "$HTTPD_URL/smart/http_parent" $hello_oid
480 - remote-object-info "$HTTPD_URL/smart/http_parent" $tree_oid
481 - remote-object-info "$HTTPD_URL/smart/http_parent" $commit_oid
482 - remote-object-info "$HTTPD_URL/smart/http_parent" $tag_oid
483 - info $hello_oid
484 - info $tree_oid
485 - info $commit_oid
486 - info $tag_oid
487 - EOF
488 - test_cmp expect actual
489 - )
490 -'
491 -
492 -test_expect_success 'batch-command remote-object-info http:// one line' '
493 - (
494 - set_transport_variables "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
495 - cd "$HTTPD_DOCUMENT_ROOT_PATH/http_client_empty" &&
496 -
497 - # These results prove remote-object-info can get object info from the remote
498 - echo "$hello_oid $hello_size" >expect &&
499 - echo "$tree_oid $tree_size" >>expect &&
500 - echo "$commit_oid $commit_size" >>expect &&
501 - echo "$tag_oid $tag_size" >>expect &&
502 -
503 - # These results prove remote-object-info did not download objects from the remote
504 - echo "$hello_oid missing" >>expect &&
505 - echo "$tree_oid missing" >>expect &&
506 - echo "$commit_oid missing" >>expect &&
507 - echo "$tag_oid missing" >>expect &&
508 -
509 - git cat-file --batch-command="%(objectname) %(objectsize)" >actual <<-EOF &&
510 - remote-object-info "$HTTPD_URL/smart/http_parent" $hello_oid $tree_oid $commit_oid $tag_oid
511 - info $hello_oid
512 - info $tree_oid
513 - info $commit_oid
514 - info $tag_oid
515 - EOF
516 - test_cmp expect actual
517 - )
518 -'
519 -
520 -test_expect_success 'batch-command --buffer remote-object-info http://' '
521 - (
522 - set_transport_variables "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
523 - cd "$HTTPD_DOCUMENT_ROOT_PATH/http_client_empty" &&
524 -
525 - # These results prove remote-object-info can get object info from the remote
526 - echo "$hello_oid $hello_size" >expect &&
527 - echo "$tree_oid $tree_size" >>expect &&
528 - echo "$commit_oid $commit_size" >>expect &&
529 - echo "$tag_oid $tag_size" >>expect &&
530 -
531 - # These results prove remote-object-info did not download objects from the remote
532 - echo "$hello_oid missing" >>expect &&
533 - echo "$tree_oid missing" >>expect &&
534 - echo "$commit_oid missing" >>expect &&
535 - echo "$tag_oid missing" >>expect &&
536 -
537 - git cat-file --batch-command="%(objectname) %(objectsize)" --buffer >actual <<-EOF &&
538 - remote-object-info "$HTTPD_URL/smart/http_parent" $hello_oid $tree_oid
539 - remote-object-info "$HTTPD_URL/smart/http_parent" $commit_oid $tag_oid
540 - info $hello_oid
541 - info $tree_oid
542 - info $commit_oid
543 - info $tag_oid
544 - flush
545 - EOF
546 - test_cmp expect actual
547 - )
548 -'
549 -
550 -test_expect_success 'batch-command remote-object-info http:// default filter' '
551 - (
552 - set_transport_variables "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
553 - cd "$HTTPD_DOCUMENT_ROOT_PATH/http_client_empty" &&
554 -
555 - echo "$hello_oid $hello_size" >expect &&
556 - echo "$tree_oid $tree_size" >>expect &&
557 - echo "$commit_oid $commit_size" >>expect &&
558 - echo "$tag_oid $tag_size" >>expect &&
559 -
560 - git cat-file --batch-command >actual <<-EOF &&
561 - remote-object-info "$HTTPD_URL/smart/http_parent" $hello_oid $tree_oid
562 - remote-object-info "$HTTPD_URL/smart/http_parent" $commit_oid $tag_oid
563 - EOF
564 - test_cmp expect actual
565 - )
566 -'
567 -
568 -test_expect_success 'batch-command -Z remote-object-info http:// default filter' '
569 - (
570 - set_transport_variables "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
571 - cd "$HTTPD_DOCUMENT_ROOT_PATH/http_client_empty" &&
572 -
573 - printf "%s\0" "$hello_oid $hello_size" >expect &&
574 - printf "%s\0" "$tree_oid $tree_size" >>expect &&
575 - printf "%s\0" "$commit_oid $commit_size" >>expect &&
576 - printf "%s\0" "$tag_oid $tag_size" >>expect &&
577 -
578 - batch_input="remote-object-info $HTTPD_URL/smart/http_parent $hello_oid $tree_oid
579 -remote-object-info $HTTPD_URL/smart/http_parent $commit_oid $tag_oid
580 -" &&
581 - echo_without_newline_nul "$batch_input" >commands_null_delimited &&
582 -
583 - git cat-file --batch-command -Z < commands_null_delimited >actual &&
584 - test_cmp expect actual
585 - )
586 -'
587 -
588 -test_expect_success 'remote-object-info fails on unsupported filter option (objectsize:disk)' '
589 - (
590 - set_transport_variables "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
591 - cd "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
592 -
593 - echo "$hello_oid " >expect &&
594 -
595 - git cat-file --batch-command="%(objectname) %(objectsize:disk)" >actual <<-EOF &&
596 - remote-object-info "$HTTPD_URL/smart/http_parent" $hello_oid
597 - EOF
598 - test_cmp expect actual
599 - )
600 -'
601 -
602 -test_expect_success 'remote-object-info fails on unsupported filter option (deltabase)' '
603 - (
604 - set_transport_variables "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
605 - cd "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
606 -
607 - echo "" >expect &&
608 -
609 - git cat-file --batch-command="%(deltabase)" >actual <<-EOF &&
610 - remote-object-info "$HTTPD_URL/smart/http_parent" $hello_oid
611 - EOF
612 - test_cmp expect actual
613 - )
614 -'
615 -
616 -test_expect_success 'remote-object-info fails on server with legacy protocol' '
617 - (
618 - set_transport_variables "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
619 - cd "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
620 -
621 - test_must_fail git -c protocol.version=0 cat-file --batch-command="%(objectname) %(objectsize)" 2>err <<-EOF &&
622 - remote-object-info "$HTTPD_URL/smart/http_parent" $hello_oid
623 - EOF
624 - test_grep "object-info requires protocol v2" err
625 - )
626 -'
627 -
628 -test_expect_success 'remote-object-info fails on server with legacy protocol with default filter' '
629 - (
630 - set_transport_variables "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
631 - cd "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
632 -
633 - test_must_fail git -c protocol.version=0 cat-file --batch-command 2>err <<-EOF &&
634 - remote-object-info "$HTTPD_URL/smart/http_parent" $hello_oid
635 - EOF
636 - test_grep "object-info requires protocol v2" err
637 - )
638 -'
639 -
640 -test_expect_success 'remote-object-info fails on malformed OID' '
641 - (
642 - set_transport_variables "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
643 - cd "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
644 - malformed_object_id="this_id_is_not_valid" &&
645 -
646 - test_must_fail git cat-file --batch-command="%(objectname) %(objectsize)" 2>err <<-EOF &&
647 - remote-object-info "$HTTPD_URL/smart/http_parent" $malformed_object_id
648 - EOF
649 - test_grep "not a valid object name '$malformed_object_id'" err
650 - )
651 -'
652 -
653 -test_expect_success 'remote-object-info fails on malformed OID with default filter' '
654 - (
655 - set_transport_variables "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
656 - cd "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
657 - malformed_object_id="this_id_is_not_valid" &&
658 -
659 - test_must_fail git cat-file --batch-command 2>err <<-EOF &&
660 - remote-object-info "$HTTPD_URL/smart/http_parent" $malformed_object_id
661 - EOF
662 - test_grep "not a valid object name '$malformed_object_id'" err
663 - )
664 -'
665 -
666 -test_expect_success 'remote-object-info fails on not providing OID' '
667 - (
668 - set_transport_variables "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
669 - cd "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
670 -
671 - test_must_fail git cat-file --batch-command="%(objectname) %(objectsize)" 2>err <<-EOF &&
672 - remote-object-info "$HTTPD_URL/smart/http_parent"
673 - EOF
674 - test_grep "remote-object-info requires objects" err
675 - )
676 -'
677 -
678 -
679 -# Test --batch-command remote-object-info with 'http://' transport and
680 -# transfer.advertiseobjectinfo set to false, i.e. server does not have object-info capability
681 -test_expect_success 'batch-command remote-object-info http:// fails when transfer.advertiseobjectinfo=false ' '
682 - (
683 - set_transport_variables "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
684 - git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" config transfer.advertiseobjectinfo false &&
685 -
686 - test_must_fail git cat-file --batch-command="%(objectname) %(objectsize)" 2>err <<-EOF &&
687 - remote-object-info "$HTTPD_URL/smart/http_parent" $hello_oid $tree_oid $commit_oid $tag_oid
688 - EOF
689 - test_grep "object-info capability is not enabled on the server" err &&
690 -
691 - # revert server state back
692 - git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" config transfer.advertiseobjectinfo true
693 - )
694 -'
695 -
696 -# DO NOT add non-httpd-specific tests here, because the last part of this
697 -# test script is only executed when httpd is available and enabled.
698 -
699 -test_done
transport-helper.c
+3 -12
@@ -266,9 +266,9 @@ static int disconnect_helper(struct transport *transport)
266 close(data->helper->out);
267 fclose(data->out);
268 res = finish_command(data->helper);
269 + FREE_AND_NULL(data->name);
270 FREE_AND_NULL(data->helper);
271 }
271 - FREE_AND_NULL(data->name);
272 return res;
273 }
274
@@ -727,7 +727,8 @@ static int fetch_refs(struct transport *transport,
727
728 /*
729 * If we reach here, then the server, the client, and/or the transport
730 - * helper does not support protocol v2. --negotiate-only.
730 + * helper does not support protocol v2. --negotiate-only requires
731 + * protocol v2.
732 */
733 if (data->transport_options.acked_commits) {
734 warning(_("--negotiate-only requires protocol v2"));
@@ -783,15 +784,6 @@ static int fetch_refs(struct transport *transport,
784 return -1;
785 }
786
786 -static int fetch_object_info_helper(struct transport *transport)
787 -{
788 - get_helper(transport);
789 - if (process_connect(transport, 0))
790 - return transport->vtable->fetch_object_info(transport);
791 -
792 - die(_("object-info requires protocol v2"));
793 -}
794 -
787 struct push_update_ref_state {
788 struct ref *hint;
789 struct ref_push_report *report;
@@ -1338,7 +1330,6 @@ static struct transport_vtable vtable = {
1330 .get_refs_list = get_refs_list,
1331 .get_bundle_uri = get_bundle_uri,
1332 .fetch_refs = fetch_refs,
1341 - .fetch_object_info = fetch_object_info_helper,
1333 .push_refs = push_refs,
1334 .connect = connect_helper,
1335 .disconnect = release_helper
transport-internal.h
-8
@@ -45,14 +45,6 @@ struct transport_vtable {
45 **/
46 int (*fetch_refs)(struct transport *transport, int refs_nr, struct ref **refs);
47
48 - /*
49 - * Fetch object info (only size currently) from remote without
50 - * downloading the objects.
51 - *
52 - * Uses object-info capability of v2 protocol.
53 - */
54 - int (*fetch_object_info)(struct transport *transport);
55 -
48 /**
49 * Push the objects and refs. Send the necessary objects, and
50 * then, for any refs where peer_ref is set and
transport.c
-46
@@ -1,4 +1,3 @@
1 -#include "compat/posix.h"
1 #define USE_THE_REPOSITORY_VARIABLE
2
3 #include "git-compat-util.h"
@@ -10,7 +9,6 @@
9 #include "hook.h"
10 #include "pkt-line.h"
11 #include "fetch-pack.h"
13 -#include "fetch-object-info.h"
12 #include "remote.h"
13 #include "connect.h"
14 #include "send-pack.h"
@@ -434,48 +432,6 @@ static int get_bundle_uri(struct transport *transport)
432 transport->bundles, stateless_rpc);
433 }
434
437 -static int fetch_object_info_via_pack(struct transport *transport)
438 -{
439 - int ret = 0;
440 - struct git_transport_data *data = transport->data;
441 - struct packet_reader reader;
442 - struct object_info_args args = { 0 };
443 -
444 - args.server_options = transport->server_options;
445 - args.oids = transport->smart_options->object_info_oids;
446 - args.object_info_options = transport->smart_options->object_info_options;
447 - string_list_sort(args.object_info_options);
448 -
449 - connect_setup(transport, 0);
450 - packet_reader_init(&reader, data->fd[0], NULL, 0,
451 - PACKET_READ_CHOMP_NEWLINE |
452 - PACKET_READ_GENTLE_ON_EOF |
453 - PACKET_READ_DIE_ON_ERR_PACKET);
454 -
455 - data->version = discover_version(&reader);
456 - transport->hash_algo = reader.hash_algo;
457 -
458 - ret = fetch_object_info(data->version, &args, &reader,
459 - data->options.object_info_data,
460 - transport->stateless_rpc, data->fd[1]);
461 -
462 - close(data->fd[0]);
463 - if (data->fd[1] >= 0)
464 - close(data->fd[1]);
465 - if (finish_connect(data->conn))
466 - ret = -1;
467 - data->conn = NULL;
468 -
469 - return ret;
470 -}
471 -
472 -int transport_fetch_object_info(struct transport *transport)
473 -{
474 - if (!transport->vtable->fetch_object_info)
475 - die(_("remote does not support object-info"));
476 - return transport->vtable->fetch_object_info(transport);
477 -}
478 -
435 static int fetch_refs_via_pack(struct transport *transport,
436 int nr_heads, struct ref **to_fetch)
437 {
@@ -1048,7 +1004,6 @@ static struct transport_vtable taken_over_vtable = {
1004 .get_refs_list = get_refs_via_connect,
1005 .get_bundle_uri = get_bundle_uri,
1006 .fetch_refs = fetch_refs_via_pack,
1051 - .fetch_object_info = fetch_object_info_via_pack,
1007 .push_refs = git_transport_push,
1008 .disconnect = disconnect_git
1009 };
@@ -1214,7 +1169,6 @@ static struct transport_vtable builtin_smart_vtable = {
1169 .get_refs_list = get_refs_via_connect,
1170 .get_bundle_uri = get_bundle_uri,
1171 .fetch_refs = fetch_refs_via_pack,
1217 - .fetch_object_info = fetch_object_info_via_pack,
1172 .push_refs = git_transport_push,
1173 .connect = connect_git,
1174 .disconnect = disconnect_git
transport.h
-10
@@ -6,7 +6,6 @@
6 #include "list-objects-filter-options.h"
7 #include "string-list.h"
8 #include "connect.h"
9 -#include "odb.h"
9
10 struct git_transport_options {
11 unsigned thin : 1;
@@ -56,10 +55,6 @@ struct git_transport_options {
55 * common commits to this oidset instead of fetching any packfiles.
56 */
57 struct oidset *acked_commits;
59 -
60 - struct oid_array *object_info_oids;
61 - struct object_info *object_info_data;
62 - struct string_list *object_info_options;
58 };
59
60 enum transport_family {
@@ -314,11 +309,6 @@ int transport_get_remote_bundle_uri(struct transport *transport);
309 const struct git_hash_algo *transport_get_hash_algo(struct transport *transport);
310 int transport_fetch_refs(struct transport *transport, struct ref *refs);
311
317 -/*
318 - * Fetch the object info from remote
319 - */
320 -int transport_fetch_object_info(struct transport *transport);
321 -
312 /*
313 * If this flag is set, unlocking will avoid to call non-async-signal-safe
314 * functions. This will necessarily leave behind some data structures which