From: Stefan Beller <sbeller@google.com>
To: dturner@twopensource.com
Cc: git@vger.kernel.org, Stefan Beller <sbeller@google.com>
Subject: [PATCH 05/14] transport: add infrastructure to support a protocol version number
Date: Fri, 29 Apr 2016 16:34:38 -0700 [thread overview]
Message-ID: <1461972887-22100-6-git-send-email-sbeller@google.com> (raw)
In-Reply-To: <1461972887-22100-1-git-send-email-sbeller@google.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
---
fetch-pack.h | 1 +
remote.c | 2 ++
remote.h | 2 ++
transport-helper.c | 1 +
transport.c | 20 ++++++++++++++++++--
transport.h | 8 ++++++++
6 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/fetch-pack.h b/fetch-pack.h
index bb7fd76..3314362 100644
--- a/fetch-pack.h
+++ b/fetch-pack.h
@@ -8,6 +8,7 @@ struct sha1_array;
struct fetch_pack_args {
const char *uploadpack;
+ int transport_version;
int unpacklimit;
int depth;
unsigned quiet:1;
diff --git a/remote.c b/remote.c
index 28fd676..760611d 100644
--- a/remote.c
+++ b/remote.c
@@ -9,6 +9,7 @@
#include "string-list.h"
#include "mergesort.h"
#include "argv-array.h"
+#include "transport.h"
enum map_direction { FROM_SRC, FROM_DST };
@@ -164,6 +165,7 @@ static struct remote *make_remote(const char *name, int len)
return ret;
ret = xcalloc(1, sizeof(struct remote));
+ ret->transport_version = DEFAULT_TRANSPORT_VERSION;
ret->prune = -1; /* unspecified */
ALLOC_GROW(remotes, remotes_nr + 1, remotes_alloc);
remotes[remotes_nr++] = ret;
diff --git a/remote.h b/remote.h
index c21fd37..cdb25d0 100644
--- a/remote.h
+++ b/remote.h
@@ -51,6 +51,8 @@ struct remote {
const char *receivepack;
const char *uploadpack;
+ int transport_version;
+
/*
* for curl remotes only
*/
diff --git a/transport-helper.c b/transport-helper.c
index b934183..3cb386f 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -248,6 +248,7 @@ static int disconnect_helper(struct transport *transport)
}
static const char *unsupported_options[] = {
+ TRANS_OPT_TRANSPORTVERSION,
TRANS_OPT_UPLOADPACK,
TRANS_OPT_RECEIVEPACK,
TRANS_OPT_THIN,
diff --git a/transport.c b/transport.c
index 095e61f..608b92c 100644
--- a/transport.c
+++ b/transport.c
@@ -151,6 +151,16 @@ static int set_git_option(struct git_transport_options *opts,
die("transport: invalid depth option '%s'", value);
}
return 0;
+ } else if (!strcmp(name, TRANS_OPT_TRANSPORTVERSION)) {
+ if (!value)
+ opts->transport_version = DEFAULT_TRANSPORT_VERSION;
+ else {
+ char *end;
+ opts->transport_version = strtol(value, &end, 0);
+ if (*end)
+ die("transport: invalid transport version option '%s'", value);
+ }
+ return 0;
}
return 1;
}
@@ -203,6 +213,7 @@ static int fetch_refs_via_pack(struct transport *transport,
memset(&args, 0, sizeof(args));
args.uploadpack = data->options.uploadpack;
+ args.transport_version = data->options.transport_version;
args.keep_pack = data->options.keep;
args.lock_pack = 1;
args.use_thin_pack = data->options.thin;
@@ -694,6 +705,8 @@ struct transport *transport_get(struct remote *remote, const char *url)
ret->connect = connect_git;
ret->disconnect = disconnect_git;
ret->smart_options = &(data->options);
+ ret->smart_options->transport_version =
+ DEFAULT_TRANSPORT_VERSION;
data->conn = NULL;
data->got_remote_heads = 0;
@@ -706,12 +719,15 @@ struct transport *transport_get(struct remote *remote, const char *url)
if (ret->smart_options) {
ret->smart_options->thin = 1;
- ret->smart_options->uploadpack = "git-upload-pack";
+ ret->smart_options->uploadpack = DEFAULT_TRANSPORT_UPLOAD_PACK;
if (remote->uploadpack)
ret->smart_options->uploadpack = remote->uploadpack;
- ret->smart_options->receivepack = "git-receive-pack";
+ ret->smart_options->receivepack = DEFAULT_TRANSPORT_RECEIVE_PACK;
if (remote->receivepack)
ret->smart_options->receivepack = remote->receivepack;
+ if (remote->transport_version)
+ ret->smart_options->transport_version =
+ remote->transport_version;
}
return ret;
diff --git a/transport.h b/transport.h
index c681408..af90529 100644
--- a/transport.h
+++ b/transport.h
@@ -13,6 +13,7 @@ struct git_transport_options {
unsigned self_contained_and_connected : 1;
unsigned update_shallow : 1;
int depth;
+ int transport_version;
const char *uploadpack;
const char *receivepack;
struct push_cas_option *cas;
@@ -188,6 +189,13 @@ int transport_restrict_protocols(void);
/* Send push certificates */
#define TRANS_OPT_PUSH_CERT "pushcert"
+/* Use a new version of the git protocol */
+#define TRANS_OPT_TRANSPORTVERSION "transportversion"
+
+#define DEFAULT_TRANSPORT_VERSION 1
+#define DEFAULT_TRANSPORT_UPLOAD_PACK "git-upload-pack"
+#define DEFAULT_TRANSPORT_RECEIVE_PACK "git-receive-pack"
+
/**
* Returns 0 if the option was used, non-zero otherwise. Prints a
* message to stderr if the option is not used.
--
2.8.0.32.g71f8beb.dirty
next prev parent reply other threads:[~2016-04-29 23:35 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-29 23:34 [WIP PATCH 00/14] Protocol v2 patches Stefan Beller
2016-04-29 23:34 ` [PATCH 01/14] upload-pack: make client capability parsing code a separate function Stefan Beller
2016-04-29 23:34 ` [PATCH 02/14] upload-pack.c: Refactor capability advertising Stefan Beller
2016-04-30 1:04 ` David Turner
2016-05-04 20:05 ` Junio C Hamano
2016-04-29 23:34 ` [PATCH 03/14] upload-pack-2: Implement the version 2 of upload-pack Stefan Beller
2016-05-02 17:43 ` David Turner
2016-05-02 17:51 ` Stefan Beller
2016-05-02 18:56 ` David Turner
2016-05-03 0:31 ` Duy Nguyen
2016-05-04 20:11 ` Junio C Hamano
2016-04-29 23:34 ` [PATCH 04/14] connect: rewrite feature parsing to work on string_list Stefan Beller
2016-05-02 18:18 ` David Turner
2016-05-02 18:46 ` Stefan Beller
2016-05-04 20:13 ` Junio C Hamano
2016-05-17 22:23 ` David Turner
2016-04-29 23:34 ` Stefan Beller [this message]
2016-04-29 23:34 ` [PATCH 06/14] remote.h: add get_remote_capabilities, request_capabilities Stefan Beller
2016-05-02 18:57 ` David Turner
2016-05-03 5:33 ` Jeff King
2016-05-03 21:21 ` David Turner
2016-05-04 16:44 ` Stefan Beller
2016-04-29 23:34 ` [PATCH 07/14] fetch-pack: move capability selection out of do_fetch_pack Stefan Beller
2016-04-29 23:34 ` [PATCH 08/14] fetch-pack: factor out get_selected_capabilities_list Stefan Beller
2016-05-02 19:09 ` David Turner
2016-04-29 23:34 ` [PATCH 09/14] fetch-pack: Add negotiate_capabilities Stefan Beller
2016-04-29 23:34 ` [PATCH 10/14] do_fetch_pack: select capabilities for transport version 1 only Stefan Beller
2016-04-29 23:34 ` [PATCH 11/14] builtin/fetch-pack: add argument for transport version Stefan Beller
2016-04-29 23:34 ` [PATCH 12/14] Add test for fetch-pack Stefan Beller
2016-05-02 19:45 ` David Turner
2016-04-29 23:34 ` [PATCH 13/14] WIP add test for git pull Stefan Beller
2016-04-29 23:34 ` [PATCH 14/14] WIP test git fetch Stefan Beller
2016-05-02 20:41 ` [WIP PATCH 00/14] Protocol v2 patches David Turner
2016-05-02 20:43 ` Stefan Beller
2016-05-24 22:46 ` David Turner
2016-05-24 23:03 ` Duy Nguyen
2016-05-25 16:45 ` David Turner
2016-05-25 16:23 ` Junio C Hamano
2016-05-25 19:31 ` David Turner
2016-05-25 21:29 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1461972887-22100-6-git-send-email-sbeller@google.com \
--to=sbeller@google.com \
--cc=dturner@twopensource.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).