Re: [PATCH] v2: proxy-command support for git://

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] v2: proxy-command support for git://

From: Paul Collins <hidden>
Date: 2016-06-15 22:42:10

Junio C Hamano [off-list ref] writes:
Paul Collins [off-list ref] writes:
quoted
But perhaps I do not really understand your objection.
No, I think you are getting it right.

I just wanted to avoid using the proxy script for some hosts,
depending on where you are going.  Obviously you can teach the
proxy script to do passthru for some hosts like you did in your
message.  The only difference is where the configuration is
specified.  I wanted it to be in the git configuration file
(i.e. using different proxy script or no script, depending on
the host).  Your example has that configuration wired in the
single script that is always called regardless of the
destination, and the script itself switches how it proxies,
depending on where it is going, perhaps using its own
configuration file or hardcoding.
I had some ideas along those lines, but I didn't like any of them.

 * Extend the proxy-command "protocol" with a third argument, an
   action.  For example if 'query $host $port' returns successfully,
   then git should run it with arguments 'connect $host $port',
   otherwise use git_tcp_connect().

 * Add a Proxy-Command field to the files in .git/remotes, e.g.:

     URL: git://git.kernel.org/pub/scm/git/git.git/
     Pull: master:origin
     Proxy-command: my-git-proxy-command

 * If the git config syntax is extended to allow dots in section or
   key names:

     [proxy]
     git.kernel.org = "ssh-to-bastion-proxy-command"
     git.blargco.com = "blargco-proxy-command"

   or perhaps

     [git.kernel.org]
     proxycommand = "ssh-to-bastion-proxy-command"
     [git.blargco.com]
     proxycommand = "blargco-proxy-command"

-- 
Dag vijandelijk luchtschip de huismeester is dood

Re: [PATCH] v2: proxy-command support for git://

From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-06-15 22:42:10


On Fri, 4 Nov 2005, Paul Collins wrote:
 * If the git config syntax is extended to allow dots in section or
   key names:

     [proxy]
     git.kernel.org = "ssh-to-bastion-proxy-command"
     git.blargco.com = "blargco-proxy-command"
I would suggest

	[proxy]
		command = "ssh-to-bastion-proxy-command" for git.kernel.org

and then it's easy enough to just parse the value "proxy.command" with 
code like

	host = value;
	cmd = strstr(value, " for ");
	if (!cmd)
		return -1;
	*cmd = 0;
	cmd += 5;

which would do the right thing..

The thing is, it's not just ".". I could well imagine that you'd have

	[proxy]
		command="ssh" for "ssh://kernel.org/"
		command="proxy-command" for kernel.org
		command="myprotocol-command" for "my://"

which would actually allow you to literally add your own protocol names 
(it would see that the target starts with "my://", and decide that it 
shoul drun the "myprotocol-command" for the proxy).

I'd rather allow free-form strings for the values than for the key names. 
If we allow free-form key-names, then random text files suddenly often 
become valid (but strange) config files.

Right now the non-free-form key names are the strongest syntax checker of 
the whole protocol.

		Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help