[PATCH] Make clients ask for "git program" over ssh and local transport

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Junio C Hamano
Date: Wednesday, June 25, 2008 - 3:55 pm

This will allow server side programs such as upload-pack to be installed
outside $PATH.  Connections to git-daemon still ask for "git-program" to
retain backward compatibility for daemons before 1.5.6.1 and 1.6.0.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * This is essentially your patch.  This can be in 1.6.0 clients and it
   should also be in 1.5.6.1 as people might keep ancient clients to talk
   to new servers that won't have anything but "git" on $PATH.

 builtin-clone.c      |    2 +-
 builtin-fetch-pack.c |    2 +-
 connect.c            |   10 ++++++++--
 git-parse-remote.sh  |    4 ++--
 transport.c          |    4 ++--
 5 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/builtin-clone.c b/builtin-clone.c
index 7190952..2f3e9c9 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -36,7 +36,7 @@ static int option_quiet, option_no_checkout, option_bare;
 static int option_local, option_no_hardlinks, option_shared;
 static char *option_template, *option_reference, *option_depth;
 static char *option_origin = NULL;
-static char *option_upload_pack = "git-upload-pack";
+static char *option_upload_pack = "git upload-pack";
 
 static struct option builtin_clone_options[] = {
 	OPT__QUIET(&option_quiet),
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index de1e8d1..a5f21f9 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -14,7 +14,7 @@ static int transfer_unpack_limit = -1;
 static int fetch_unpack_limit = -1;
 static int unpack_limit = 100;
 static struct fetch_pack_args args = {
-	/* .uploadpack = */ "git-upload-pack",
+	/* .uploadpack = */ "git upload-pack",
 };
 
 static const char fetch_pack_usage[] =
diff --git a/connect.c b/connect.c
index e92af29..4a32ba4 100644
--- a/connect.c
+++ b/connect.c
@@ -567,6 +567,8 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
 		 * cannot connect.
 		 */
 		char *target_host = xstrdup(host);
+		const char *program_prefix = "";
+
 		if (git_use_proxy(host))
 			git_proxy_connect(fd, host);
 		else
@@ -575,9 +577,13 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
 		 * Separate original protocol components prog and path
 		 * from extended components with a NUL byte.
 		 */
+		if (!prefixcmp(prog, "git ")) {
+			program_prefix = "git-";
+			prog += 4;
+		}
 		packet_write(fd[1],
-			     "%s %s%chost=%s%c",
-			     prog, path, 0,
+			     "%s%s %s%chost=%s%c",
+			     program_prefix, prog, path, 0,
 			     target_host, 0);
 		free(target_host);
 		free(url);
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 695a409..0f82a93 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -255,10 +255,10 @@ get_uploadpack () {
 	case "$data_source" in
 	config)
 		uplp=$(git config --get "remote.$1.uploadpack")
-		echo ${uplp:-git-upload-pack}
+		echo ${uplp:-git upload-pack}
 		;;
 	*)
-		echo "git-upload-pack"
+		echo "git upload-pack"
 		;;
 	esac
 }
diff --git a/transport.c b/transport.c
index 3ff8519..351b7f5 100644
--- a/transport.c
+++ b/transport.c
@@ -762,10 +762,10 @@ struct transport *transport_get(struct remote *remote, const char *url)
 
 		data->thin = 1;
 		data->conn = NULL;
-		data->uploadpack = "git-upload-pack";
+		data->uploadpack = "git upload-pack";
 		if (remote && remote->uploadpack)
 			data->uploadpack = remote->uploadpack;
-		data->receivepack = "git-receive-pack";
+		data->receivepack = "git receive-pack";
 		if (remote && remote->receivepack)
 			data->receivepack = remote->receivepack;
 	}
-- 
1.5.6.86.ge2da6

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] daemon: accept &quot;git program&quot; as well, Junio C Hamano, (Wed Jun 25, 3:47 pm)
[PATCH] Make clients ask for "git program" over ssh and lo ..., Junio C Hamano, (Wed Jun 25, 3:55 pm)
Re: [PATCH] daemon: accept &quot;git program&quot; as well, Shawn O. Pearce, (Wed Jun 25, 4:02 pm)
Re: [PATCH] daemon: accept &quot;git program&quot; as well, Junio C Hamano, (Wed Jun 25, 4:26 pm)
Re: [PATCH] daemon: accept &quot;git program&quot; as well, Tommi Virtanen, (Thu Jun 26, 1:20 am)
Re: [PATCH] daemon: accept &quot;git program&quot; as well, Junio C Hamano, (Thu Jun 26, 4:42 pm)