[JGIT PATCH 6/8] Support 'git upload-pack' and 'git receive-pack' over SSH

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Within the next 6 months C git clients will begin asking remote
servers for 'git $command' rather than 'git-$command' when using the
SSH transport.  This change is to allow the C git programs to be
removed from the user's $PATH, leaving only the git wrapper binary.

For the first 6 months after C git 1.6.0 gets released clients will
continue to ask for 'git-$command' but users may change that behavior
by specifically asking for 'git $command' in remote.$name.uploadpack
or remote.$name.receivepack.  Later clients (including jgit) will
change to ask for 'git $command' by default.

If we are asking for 'git $command' we cannot quote this as a single
command with a space in the path.  We split on the whitespace and
quote both sides (if necessary) to protect the strings from the shell.

Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
---
 .../spearce/jgit/transport/TransportGitSsh.java    |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/TransportGitSsh.java b/org.spearce.jgit/src/org/spearce/jgit/transport/TransportGitSsh.java
index caf531d..1bbdf04 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/TransportGitSsh.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/TransportGitSsh.java
@@ -182,7 +182,13 @@ class TransportGitSsh extends PackTransport {
 				path = (uri.getPath().substring(1));
 
 			final StringBuilder cmd = new StringBuilder();
-			sqMinimal(cmd, exe);
+			final int gitspace = exe.indexOf("git ");
+			if (gitspace >= 0) {
+				sqMinimal(cmd, exe.substring(0, gitspace + 3));
+				cmd.append(' ');
+				sqMinimal(cmd, exe.substring(gitspace + 4));
+			} else
+				sqMinimal(cmd, exe);
 			cmd.append(' ');
 			sqAlways(cmd, path);
 			channel.setCommand(cmd.toString());
-- 
1.5.6.74.g8a5e

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux