summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-12-06 17:23:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-12-06 17:23:44 (GMT)
commit4c6dad0059b2b5d1ea996ccf67f93224955b07b4 (patch)
treec873cad90875dc679c722beac0abe4ddae5d25cb /upload-pack.c
parentf65ab574441f6ed9e59e50be68480bd698d9c749 (diff)
parent6464679d9620d91b639e2681b9cc6473f3856d09 (diff)
downloadgit-4c6dad0059b2b5d1ea996ccf67f93224955b07b4.zip
git-4c6dad0059b2b5d1ea996ccf67f93224955b07b4.tar.gz
git-4c6dad0059b2b5d1ea996ccf67f93224955b07b4.tar.bz2
Merge branch 'bw/protocol-v1'
A new mechanism to upgrade the wire protocol in place is proposed and demonstrated that it works with the older versions of Git without harming them. * bw/protocol-v1: Documentation: document Extra Parameters ssh: introduce a 'simple' ssh variant i5700: add interop test for protocol transition http: tell server that the client understands v1 connect: tell server that the client understands v1 connect: teach client to recognize v1 server response upload-pack, receive-pack: introduce protocol version 1 daemon: recognize hidden request arguments protocol: introduce protocol extension mechanisms pkt-line: add packet_write function connect: in ref advertisement, shallows are last
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/upload-pack.c b/upload-pack.c
index 6d5f3c0..d5de181 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -18,6 +18,7 @@
#include "parse-options.h"
#include "argv-array.h"
#include "prio-queue.h"
+#include "protocol.h"
static const char * const upload_pack_usage[] = {
N_("git upload-pack [<options>] <dir>"),
@@ -1066,6 +1067,23 @@ int cmd_main(int argc, const char **argv)
die("'%s' does not appear to be a git repository", dir);
git_config(upload_pack_config, NULL);
- upload_pack();
+
+ switch (determine_protocol_version_server()) {
+ case protocol_v1:
+ /*
+ * v1 is just the original protocol with a version string,
+ * so just fall through after writing the version string.
+ */
+ if (advertise_refs || !stateless_rpc)
+ packet_write_fmt(1, "version 1\n");
+
+ /* fallthrough */
+ case protocol_v0:
+ upload_pack();
+ break;
+ case protocol_unknown_version:
+ BUG("unknown protocol version");
+ }
+
return 0;
}