mirror of
https://github.com/git-for-windows/git.git
synced 2026-06-14 05:33:00 -05:00
Refactor `write_fetch_command_and_capabilities()`, enabling it to serve
both fetch and additional commands.
In this context, "command" refers to the "operations" supported by
Git's wire protocol https://git-scm.com/docs/protocol-v2, such as a Git
subcommand (e.g., git-fetch(1)) or a server-side operation like
"object-info" as implemented in commit a2ba162
(object-info: support for retrieving object info, 2021-04-20).
Refactor the function signature to accept a command instead of the
hardcoded "fetch".
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>
46 lines
1.6 KiB
C
46 lines
1.6 KiB
C
#ifndef CONNECT_H
|
|
#define CONNECT_H
|
|
|
|
#include "protocol.h"
|
|
|
|
#define CONNECT_VERBOSE (1u << 0)
|
|
#define CONNECT_DIAG_URL (1u << 1)
|
|
#define CONNECT_IPV4 (1u << 2)
|
|
#define CONNECT_IPV6 (1u << 3)
|
|
enum git_connect_service {
|
|
GIT_CONNECT_UPLOAD_PACK,
|
|
GIT_CONNECT_RECEIVE_PACK,
|
|
GIT_CONNECT_UPLOAD_ARCHIVE,
|
|
};
|
|
struct child_process *git_connect(int fd[2], const char *url, enum git_connect_service, const char *prog, int flags);
|
|
int finish_connect(struct child_process *conn);
|
|
int git_connection_is_socket(struct child_process *conn);
|
|
int server_supports(const char *feature);
|
|
int parse_feature_request(const char *features, const char *feature);
|
|
const char *server_feature_value(const char *feature, size_t *len_ret);
|
|
|
|
struct packet_reader;
|
|
enum protocol_version discover_version(struct packet_reader *reader);
|
|
|
|
int server_supports_hash(const char *desired, int *feature_supported);
|
|
const char *parse_feature_value(const char *feature_list, const char *feature, size_t *lenp, size_t *offset);
|
|
int server_supports_v2(const char *c);
|
|
void ensure_server_supports_v2(const char *c);
|
|
int server_feature_v2(const char *c, const char **v);
|
|
int server_supports_feature(const char *c, const char *feature,
|
|
int die_on_error);
|
|
|
|
void check_stateless_delimiter(int stateless_rpc,
|
|
struct packet_reader *reader,
|
|
const char *error);
|
|
|
|
/*
|
|
* Writes a command along with the requested server capabilities/features into a
|
|
* request buffer.
|
|
*/
|
|
struct string_list;
|
|
void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
|
|
const struct string_list *server_options);
|
|
|
|
#endif
|