Subject: Re: [PATCH] Ask for "git program" when asking for "git-program" over SSH connection

From: "Shawn O. Pearce" <[email-masked]>
Date: Wed, 25 Jun 2008 00:44:09 -0400

Junio C Hamano <[email-masked]> wrote:
> "Shawn O. Pearce" <[email-masked]> writes:
> 
> > Sorry, but I think this change needs to go higher up, to the default
> > values that --upload-pack and remote.$name.uploadpack override,
> > so the user can at least work around it when we break her ability
> > to use github, gitosis, or anything like it.
> 
> Well, the thing is, "higher up" would not have enough clue to see if it
> needs to give dashed form (for git-daemon) or space form (for ssh), so
> that suggestion won't help much.

Actually I'd go the other direction.  Allow the higher up level
to supply "git upload-pack" and convert it to git- for the git://
protocol.  Possible patch below.

> I do not care too much about closed source service, but gitosis should be
> able to update the pattern to allow "git[ -]upload-pack" reasonably
> easily.

Pasky also has to update:

$ git ls-remote --upload-pack='git upload-pack' repo.or.cz:/srv/git/egit.git
fatal: unrecognized command 'git upload-pack '/srv/git/egit.git''
fatal: The remote end hung up unexpectedly

;-)
 
> Any other suggestions that is workable?

diff --git a/builtin-clone.c b/builtin-clone.c
index 5c5acb4..98d0f0f 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -37,7 +37,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),
@@ -58,7 +58,7 @@ static struct option builtin_clone_options[] = {
 	OPT_STRING('o', "origin", &option_origin, "branch",
 		   "use <branch> instead or 'origin' to track upstream"),
 	OPT_STRING('u', "upload-pack", &option_upload_pack, "path",
-		   "path to git-upload-pack on the remote"),
+		   "path to git upload-pack on the remote"),
 	OPT_STRING(0, "depth", &option_depth, "depth",
 		    "create a shallow clone of that depth"),
 
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index f4dbcf0..b0efd01 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..dbabd93 100644
--- a/connect.c
+++ b/connect.c
@@ -576,8 +576,8 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
 		 * from extended components with a NUL byte.
 		 */
 		packet_write(fd[1],
-			     "%s %s%chost=%s%c",
-			     prog, path, 0,
+			     "git-%s %s%chost=%s%c",
+			     prog + 4, 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;
 	}

-- 
Shawn.