vendor/libgit2/src/libgit2/transports/smart.h in rugged-1.6.5 vs vendor/libgit2/src/libgit2/transports/smart.h in rugged-1.7.1

- old
+ new

@@ -9,15 +9,18 @@ #include "common.h" #include "git2.h" #include "vector.h" -#include "netops.h" #include "push.h" #include "str.h" +#include "oidarray.h" +#include "staticstr.h" #include "git2/sys/transport.h" +#define GIT_SMART_BUFFER_SIZE 65536 + #define GIT_SIDE_BAND_DATA 1 #define GIT_SIDE_BAND_PROGRESS 2 #define GIT_SIDE_BAND_ERROR 3 #define GIT_CAP_OFS_DELTA "ofs-delta" @@ -30,10 +33,11 @@ #define GIT_CAP_REPORT_STATUS "report-status" #define GIT_CAP_THIN_PACK "thin-pack" #define GIT_CAP_SYMREF "symref" #define GIT_CAP_WANT_TIP_SHA1 "allow-tip-sha1-in-want" #define GIT_CAP_WANT_REACHABLE_SHA1 "allow-reachable-sha1-in-want" +#define GIT_CAP_SHALLOW "shallow" #define GIT_CAP_OBJECT_FORMAT "object-format=" #define GIT_CAP_AGENT "agent=" extern bool git_smart__ofs_delta_enabled; @@ -48,11 +52,13 @@ GIT_PKT_ERR, GIT_PKT_DATA, GIT_PKT_PROGRESS, GIT_PKT_OK, GIT_PKT_NG, - GIT_PKT_UNPACK + GIT_PKT_UNPACK, + GIT_PKT_SHALLOW, + GIT_PKT_UNSHALLOW } git_pkt_type; /* Used for multi_ack and multi_ack_detailed */ enum git_ack_status { GIT_ACK_NONE, @@ -120,10 +126,15 @@ typedef struct { git_pkt_type type; int unpack_ok; } git_pkt_unpack; +typedef struct { + git_pkt_type type; + git_oid oid; +} git_pkt_shallow; + typedef struct transport_smart_caps { unsigned int common:1, ofs_delta:1, multi_ack:1, multi_ack_detailed:1, @@ -132,11 +143,12 @@ include_tag:1, delete_refs:1, report_status:1, thin_pack:1, want_tip_sha1:1, - want_reachable_sha1:1; + want_reachable_sha1:1, + shallow:1; char *object_format; char *agent; } transport_smart_caps; typedef int (*packetsize_cb)(size_t received, void *payload); @@ -151,37 +163,40 @@ git_smart_subtransport_stream *current_stream; transport_smart_caps caps; git_vector refs; git_vector heads; git_vector common; + git_array_oid_t shallow_roots; git_atomic32 cancelled; packetsize_cb packetsize_cb; void *packetsize_payload; unsigned rpc : 1, have_refs : 1, connected : 1; - gitno_buffer buffer; - char buffer_data[65536]; + git_staticstr_with_size(GIT_SMART_BUFFER_SIZE) buffer; } transport_smart; /* smart_protocol.c */ int git_smart__store_refs(transport_smart *t, int flushes); int git_smart__detect_caps(git_pkt_ref *pkt, transport_smart_caps *caps, git_vector *symrefs); int git_smart__push(git_transport *transport, git_push *push); int git_smart__negotiate_fetch( git_transport *transport, git_repository *repo, - const git_remote_head * const *refs, - size_t count); + const git_fetch_negotiation *wants); +int git_smart__shallow_roots(git_oidarray *out, git_transport *transport); + int git_smart__download_pack( git_transport *transport, git_repository *repo, git_indexer_progress *stats); /* smart.c */ +int git_smart__recv(transport_smart *t); + int git_smart__negotiation_step(git_transport *transport, void *data, size_t len); int git_smart__get_push_stream(transport_smart *t, git_smart_subtransport_stream **out); int git_smart__update_heads(transport_smart *t, git_vector *symrefs); @@ -193,10 +208,10 @@ int git_pkt_parse_line(git_pkt **head, const char **endptr, const char *line, size_t linelen, git_pkt_parse_data *data); int git_pkt_buffer_flush(git_str *buf); int git_pkt_send_flush(GIT_SOCKET s); int git_pkt_buffer_done(git_str *buf); -int git_pkt_buffer_wants(const git_remote_head * const *refs, size_t count, transport_smart_caps *caps, git_str *buf); +int git_pkt_buffer_wants(const git_fetch_negotiation *wants, transport_smart_caps *caps, git_str *buf); int git_pkt_buffer_have(git_oid *oid, git_str *buf); void git_pkt_free(git_pkt *pkt); #endif