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

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2018-03-15 20:31:31 +0300
committerJunio C Hamano <gitster@pobox.com>2018-03-15 22:01:09 +0300
commit1aa8dded3afff28d8f4c24a97b237a0d9e633173 (patch)
tree15b0bc8637bea96070b572ba7724aeac259437f6 /connect.c
parent40fc51e39f178e81cbd7feadda51fca604f02ea8 (diff)
connect: don't request v2 when pushing
In order to be able to ship protocol v2 with only supporting fetch, we need clients to not issue a request to use protocol v2 when pushing (since the client currently doesn't know how to push using protocol v2). This allows a client to have protocol v2 configured in `protocol.version` and take advantage of using v2 for fetch and falling back to using v0 when pushing while v2 for push is being designed. We could run into issues if we didn't fall back to protocol v2 when pushing right now. This is because currently a server will ignore a request to use v2 when contacting the 'receive-pack' endpoint and fall back to using v0, but when push v2 is rolled out to servers, the 'receive-pack' endpoint will start responding using v2. So we don't want to get into a state where a client is requesting to push with v2 before they actually know how to push using v2. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/connect.c b/connect.c
index a57a060dc4..54971166ac 100644
--- a/connect.c
+++ b/connect.c
@@ -1218,6 +1218,14 @@ struct child_process *git_connect(int fd[2], const char *url,
enum protocol protocol;
enum protocol_version version = get_protocol_version_config();
+ /*
+ * NEEDSWORK: If we are trying to use protocol v2 and we are planning
+ * to perform a push, then fallback to v0 since the client doesn't know
+ * how to push yet using v2.
+ */
+ if (version == protocol_v2 && !strcmp("git-receive-pack", prog))
+ version = protocol_v0;
+
/* Without this we cannot rely on waitpid() to tell
* what happened to our children.
*/