mirror of
https://github.com/git/git.git
synced 2024-11-24 02:17:02 +08:00
0bbc0bc574
Currently, a response to a fetch request has sideband support only while the packfile is being sent, meaning that the server cannot send notices until the start of the packfile. Extend sideband support in protocol v2 fetch responses to the whole response. upload-pack will advertise it if the uploadpack.allowsidebandall configuration variable is set, and fetch-pack will automatically request it if advertised. If the sideband is to be used throughout the whole response, upload-pack will use it to send errors instead of prefixing a PKT-LINE payload with "ERR ". This will be tested in a subsequent patch. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
30 lines
903 B
C
30 lines
903 B
C
#ifndef SIDEBAND_H
|
|
#define SIDEBAND_H
|
|
|
|
enum sideband_type {
|
|
SIDEBAND_PROTOCOL_ERROR = -2,
|
|
SIDEBAND_REMOTE_ERROR = -1,
|
|
SIDEBAND_FLUSH = 0,
|
|
SIDEBAND_PRIMARY = 1
|
|
};
|
|
|
|
/*
|
|
* Inspects a multiplexed packet read from the remote. If this packet is a
|
|
* progress packet and thus should not be processed by the caller, returns 0.
|
|
* Otherwise, returns 1, releases scratch, and sets sideband_type.
|
|
*
|
|
* If this packet is SIDEBAND_PROTOCOL_ERROR, SIDEBAND_REMOTE_ERROR, or a
|
|
* progress packet, also prints a message to stderr.
|
|
*
|
|
* scratch must be a struct strbuf allocated by the caller. It is used to store
|
|
* progress messages split across multiple packets.
|
|
*/
|
|
int demultiplex_sideband(const char *me, char *buf, int len,
|
|
int die_on_error,
|
|
struct strbuf *scratch,
|
|
enum sideband_type *sideband_type);
|
|
|
|
void send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max);
|
|
|
|
#endif
|