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:
authorJunio C Hamano <gitster@pobox.com>2023-03-28 20:51:52 +0300
committerJunio C Hamano <gitster@pobox.com>2023-03-28 20:51:52 +0300
commitf879501ad08b228797f5473092186900828681d5 (patch)
treec48bcb2ba63e3101da8d9f24e5a242e4538589d8 /connect.c
parent8069aa01cd83d187813117b34ed718245d56eac9 (diff)
parenteaa0fd658442c2b83dfad918d636bba3ca3b4087 (diff)
Merge branch 'jk/fix-proto-downgrade-to-v0'
Transports that do not support protocol v2 did not correctly fall back to protocol v0 under certain conditions, which has been corrected. * jk/fix-proto-downgrade-to-v0: git_connect(): fix corner cases in downgrading v2 to v0
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/connect.c b/connect.c
index 000865bc33..ed486116ee 100644
--- a/connect.c
+++ b/connect.c
@@ -1408,6 +1408,7 @@ static void fill_ssh_args(struct child_process *conn, const char *ssh_host,
* the connection failed).
*/
struct child_process *git_connect(int fd[2], const char *url,
+ const char *name,
const char *prog, int flags)
{
char *hostandport, *path;
@@ -1417,10 +1418,11 @@ struct child_process *git_connect(int fd[2], const char *url,
/*
* 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.
+ * to perform any operation that doesn't involve upload-pack (i.e., a
+ * fetch, ls-remote, etc), then fallback to v0 since we don't know how
+ * to do anything else (like push or remote archive) via v2.
*/
- if (version == protocol_v2 && !strcmp("git-receive-pack", prog))
+ if (version == protocol_v2 && strcmp("git-upload-pack", name))
version = protocol_v0;
/* Without this we cannot rely on waitpid() to tell