Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2013-10-28 20:25:44 +0400
committerVicent Martí <vicent@github.com>2013-10-28 20:25:44 +0400
commit5c50f22a93c78190fb7d81802199ff9defc8cf55 (patch)
tree66e9f28cb6a3c7cc2f4f4931173410cd4f80b32a /src/transports
parent064e6e8121a6265b42f41f1b12468573cb3ccb19 (diff)
parentab46b1d8ebcdc820aefe2c1391d4be73939bce95 (diff)
Merge pull request #1891 from libgit2/cmn/fix-thin-packs
Add support for thin packs
Diffstat (limited to 'src/transports')
-rw-r--r--src/transports/smart.h4
-rw-r--r--src/transports/smart_pkt.c3
-rw-r--r--src/transports/smart_protocol.c6
3 files changed, 12 insertions, 1 deletions
diff --git a/src/transports/smart.h b/src/transports/smart.h
index 3519477da..7fda27d4e 100644
--- a/src/transports/smart.h
+++ b/src/transports/smart.h
@@ -21,6 +21,7 @@
#define GIT_CAP_INCLUDE_TAG "include-tag"
#define GIT_CAP_DELETE_REFS "delete-refs"
#define GIT_CAP_REPORT_STATUS "report-status"
+#define GIT_CAP_THIN_PACK "thin-pack"
enum git_pkt_type {
GIT_PKT_CMD,
@@ -116,7 +117,8 @@ typedef struct transport_smart_caps {
side_band_64k:1,
include_tag:1,
delete_refs:1,
- report_status:1;
+ report_status:1,
+ thin_pack:1;
} transport_smart_caps;
typedef int (*packetsize_cb)(size_t received, void *payload);
diff --git a/src/transports/smart_pkt.c b/src/transports/smart_pkt.c
index 99da37567..a1f623c78 100644
--- a/src/transports/smart_pkt.c
+++ b/src/transports/smart_pkt.c
@@ -472,6 +472,9 @@ static int buffer_want_with_caps(const git_remote_head *head, transport_smart_ca
if (caps->include_tag)
git_buf_puts(&str, GIT_CAP_INCLUDE_TAG " ");
+ if (caps->thin_pack)
+ git_buf_puts(&str, GIT_CAP_THIN_PACK " ");
+
if (git_buf_oom(&str))
return -1;
diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c
index 3b4d57856..af6e35fa1 100644
--- a/src/transports/smart_protocol.c
+++ b/src/transports/smart_protocol.c
@@ -128,6 +128,12 @@ int git_smart__detect_caps(git_pkt_ref *pkt, transport_smart_caps *caps)
continue;
}
+ if (!git__prefixcmp(ptr, GIT_CAP_THIN_PACK)) {
+ caps->common = caps->thin_pack = 1;
+ ptr += strlen(GIT_CAP_THIN_PACK);
+ continue;
+ }
+
/* We don't know this capability, so skip it */
ptr = strchr(ptr, ' ');
}