summaryrefslogtreecommitdiff
path: root/builtin/fetch-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-01-29 20:47:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-29 20:47:54 (GMT)
commitf33989464ecfc05a937328430b7e74819f7285dd (patch)
treeab6458b63d5ffee867b7790e94cf13a1d038a11b /builtin/fetch-pack.c
parentd3b017822d6b37523a9ee2d9d5bc9a2513221ae5 (diff)
parent4316ff306812025385a71519f7f71abaa36b3c31 (diff)
downloadgit-f33989464ecfc05a937328430b7e74819f7285dd.zip
git-f33989464ecfc05a937328430b7e74819f7285dd.tar.gz
git-f33989464ecfc05a937328430b7e74819f7285dd.tar.bz2
Merge branch 'jt/fetch-pack-v2'
"git fetch-pack" now can talk the version 2 protocol. * jt/fetch-pack-v2: fetch-pack: support protocol version 2
Diffstat (limited to 'builtin/fetch-pack.c')
-rw-r--r--builtin/fetch-pack.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index 63e69a5..f6a5134 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -55,6 +55,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
struct oid_array shallow = OID_ARRAY_INIT;
struct string_list deepen_not = STRING_LIST_INIT_DUP;
struct packet_reader reader;
+ enum protocol_version version;
fetch_if_missing = 0;
@@ -219,9 +220,11 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
PACKET_READ_CHOMP_NEWLINE |
PACKET_READ_GENTLE_ON_EOF);
- switch (discover_version(&reader)) {
+ version = discover_version(&reader);
+ switch (version) {
case protocol_v2:
- die("support for protocol v2 not implemented yet");
+ get_remote_refs(fd[1], &reader, &ref, 0, NULL, NULL);
+ break;
case protocol_v1:
case protocol_v0:
get_remote_heads(&reader, &ref, 0, NULL, &shallow);
@@ -231,7 +234,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
}
ref = fetch_pack(&args, fd, conn, ref, dest, sought, nr_sought,
- &shallow, pack_lockfile_ptr, protocol_v0);
+ &shallow, pack_lockfile_ptr, version);
if (pack_lockfile) {
printf("lock %s\n", pack_lockfile);
fflush(stdout);