Skip to content

Commit 2057c50

Browse files
committed
Merge branch 'js/protocol-advertise-multi' into pu
The transport layer has been updated so that the protocol version used can be negotiated between the parties, by the initiator listing the protocol versions it is willing to talk, and the other side choosing from one of them. * js/protocol-advertise-multi: protocol: advertise multiple supported versions
2 parents c410686 + 6da1f1a commit 2057c50

20 files changed

+253
-79
lines changed

builtin/archive.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "transport.h"
99
#include "parse-options.h"
1010
#include "pkt-line.h"
11+
#include "protocol.h"
1112
#include "sideband.h"
1213

1314
static void create_output_file(const char *output_file)
@@ -95,6 +96,8 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
9596
OPT_END()
9697
};
9798

99+
register_allowed_protocol_version(protocol_v0);
100+
98101
argc = parse_options(argc, argv, prefix, local_opts, NULL,
99102
PARSE_OPT_KEEP_ALL);
100103

builtin/clone.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
909909

910910
struct argv_array ref_prefixes = ARGV_ARRAY_INIT;
911911

912+
register_allowed_protocol_version(protocol_v2);
913+
register_allowed_protocol_version(protocol_v1);
914+
register_allowed_protocol_version(protocol_v0);
915+
912916
fetch_if_missing = 0;
913917

914918
packet_trace_identity("clone");

builtin/fetch-pack.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
5959

6060
fetch_if_missing = 0;
6161

62+
register_allowed_protocol_version(protocol_v2);
63+
register_allowed_protocol_version(protocol_v1);
64+
register_allowed_protocol_version(protocol_v0);
65+
6266
packet_trace_identity("fetch-pack");
6367

6468
memset(&args, 0, sizeof(args));

builtin/fetch.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "argv-array.h"
2222
#include "utf8.h"
2323
#include "packfile.h"
24+
#include "protocol.h"
2425
#include "list-objects-filter-options.h"
2526
#include "commit-reach.h"
2627

@@ -1574,6 +1575,10 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
15741575
int prune_tags_ok = 1;
15751576
struct argv_array argv_gc_auto = ARGV_ARRAY_INIT;
15761577

1578+
register_allowed_protocol_version(protocol_v2);
1579+
register_allowed_protocol_version(protocol_v1);
1580+
register_allowed_protocol_version(protocol_v0);
1581+
15771582
packet_trace_identity("fetch");
15781583

15791584
fetch_if_missing = 0;

builtin/ls-remote.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "builtin.h"
22
#include "cache.h"
3+
#include "protocol.h"
34
#include "transport.h"
45
#include "ref-filter.h"
56
#include "remote.h"
@@ -79,6 +80,10 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
7980

8081
memset(&ref_array, 0, sizeof(ref_array));
8182

83+
register_allowed_protocol_version(protocol_v2);
84+
register_allowed_protocol_version(protocol_v1);
85+
register_allowed_protocol_version(protocol_v0);
86+
8287
argc = parse_options(argc, argv, prefix, options, ls_remote_usage,
8388
PARSE_OPT_STOP_AT_NON_OPTION);
8489
dest = argv[0];

builtin/pull.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "config.h"
1111
#include "builtin.h"
1212
#include "parse-options.h"
13+
#include "protocol.h"
1314
#include "exec-cmd.h"
1415
#include "run-command.h"
1516
#include "sha1-array.h"
@@ -874,6 +875,10 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
874875
struct object_id rebase_fork_point;
875876
int autostash;
876877

878+
register_allowed_protocol_version(protocol_v2);
879+
register_allowed_protocol_version(protocol_v1);
880+
register_allowed_protocol_version(protocol_v0);
881+
877882
if (!getenv("GIT_REFLOG_ACTION"))
878883
set_reflog_message(argc, argv);
879884

builtin/push.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "remote.h"
1111
#include "transport.h"
1212
#include "parse-options.h"
13+
#include "protocol.h"
1314
#include "submodule.h"
1415
#include "submodule-config.h"
1516
#include "send-pack.h"
@@ -590,6 +591,9 @@ int cmd_push(int argc, const char **argv, const char *prefix)
590591
OPT_END()
591592
};
592593

594+
register_allowed_protocol_version(protocol_v1);
595+
register_allowed_protocol_version(protocol_v0);
596+
593597
packet_trace_identity("push");
594598
git_config(git_push_config, &flags);
595599
argc = parse_options(argc, argv, prefix, options, push_usage, 0);

builtin/receive-pack.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,6 +1945,9 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
19451945

19461946
packet_trace_identity("receive-pack");
19471947

1948+
register_allowed_protocol_version(protocol_v1);
1949+
register_allowed_protocol_version(protocol_v0);
1950+
19481951
argc = parse_options(argc, argv, prefix, options, receive_pack_usage, 0);
19491952

19501953
if (argc > 1)

builtin/send-pack.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
184184
OPT_END()
185185
};
186186

187+
register_allowed_protocol_version(protocol_v1);
188+
register_allowed_protocol_version(protocol_v0);
189+
187190
git_config(send_pack_config, NULL);
188191
argc = parse_options(argc, argv, prefix, options, send_pack_usage, 0);
189192
if (argc > 0) {

builtin/upload-archive.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "builtin.h"
66
#include "archive.h"
77
#include "pkt-line.h"
8+
#include "protocol.h"
89
#include "sideband.h"
910
#include "run-command.h"
1011
#include "argv-array.h"
@@ -82,6 +83,8 @@ int cmd_upload_archive(int argc, const char **argv, const char *prefix)
8283
if (argc == 2 && !strcmp(argv[1], "-h"))
8384
usage(upload_archive_usage);
8485

86+
register_allowed_protocol_version(protocol_v0);
87+
8588
/*
8689
* Set up sideband subprocess.
8790
*

0 commit comments

Comments
 (0)