mirror of
https://github.com/git-for-windows/git.git
synced 2026-06-14 05:33:00 -05:00
Sometimes, it is beneficial to retrieve information about an object without downloading it entirely. The server-side logic for this functionality was implemented in commit "a2ba162cda (object-info: support for retrieving object info, 2021-04-20)." And the wire format is documented at https://git-scm.com/docs/protocol-v2#_object_info. This commit introduces client functions to interact with the server. Currently, the client supports requesting a list of object IDs with the 'size' feature from a v2 server. If the server does not advertise this feature (i.e., transfer.advertiseobjectinfo is set to false), the client will return an error and exit. Notice that the entire request is written into req_buf before being sent to the remote. This approach follows the pattern used in the `send_fetch_request()` logic within fetch-pack.c. Streaming the request is not addressed in this patch. Helped-by: Jonathan Tan <jonathantanmy@google.com> Helped-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Calvin Wan <calvinwan@google.com> Signed-off-by: Eric Ju <eric.peijian@gmail.com> Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 lines
601 B
C
23 lines
601 B
C
#ifndef FETCH_OBJECT_INFO_H
|
|
#define FETCH_OBJECT_INFO_H
|
|
|
|
#include "pkt-line.h"
|
|
#include "protocol.h"
|
|
#include "odb.h"
|
|
|
|
struct object_info_args {
|
|
struct string_list *object_info_options;
|
|
const struct string_list *server_options;
|
|
struct oid_array *oids;
|
|
};
|
|
|
|
/*
|
|
* Sends git-cat-file object-info command into the request buf and read the
|
|
* results from packets.
|
|
*/
|
|
int fetch_object_info(enum protocol_version version, struct object_info_args *args,
|
|
struct packet_reader *reader, struct object_info *object_info_data,
|
|
int stateless_rpc, int fd_out);
|
|
|
|
#endif /* FETCH_OBJECT_INFO_H */
|