schacon / hg-git

mercurial to git bridge, pushed to directly from the hg-git plugin in Hg
GNU General Public License v2.0
620 stars 71 forks source link

Honour the $GIT_SSH on unix #242

Closed dlmiles closed 12 years ago

dlmiles commented 12 years ago

man git # has documentation on GIT_SSH but when hg-git forks to execve() the ssh command it does not make use of the environment variable when it is set.

This should be a simple matter to fix by looking up the environment variable and using that value as the command to run, if it is the environment variable is not set it uses the "ssh" default (just as is the case now).

After running strace on 'hg' $ strace -s 1024 -f -o /tmp/hg.txt hg push git+ssh://git@mydomain.org:19418/oss/mirror/repo.git

$ grep " execve" /tmp/hg.txt 7137 execve("/bin/sh", ["/bin/sh", "-c", "ssh git@mydomain.org -p 19418 'git-receive-pack '\''/oss/mirror/repo.git'\'''"], [/* 101 vars /] <unfinished ...> 7137 <... execve resumed> ) = 0 7137 execve("/usr/bin/ssh", ["ssh", "git@mydomain.org", "-p", "19418", "git-receive-pack '/oss/mirror/repo.git'"], [/ 100 vars */]) = 0

$ set | grep GIT_SSH GIT_SSH=git-ssh

durin42 commented 12 years ago

This doesn't at all seem like the right thing to do - instead we should honor Mercurial's ssh configuration and do configuration that way.

durin42 commented 12 years ago

(For what it's worth, I'm not at all sure we respect hg's settings for that either.)

durin42 commented 12 years ago

We respect the Mercurial ui.ssh setting, which is how you should be configuring Mercurial (and by association hg-git) for alternate ssh transports. You can do this on a per-repository basis by editing .hg/hgrc if needed.

dlmiles commented 12 years ago

I think you should use Mercurial settings when talking to HG server and GIT policies way when talking to a git server. This matters shows up when talking the git server.

Using HG configuration allows for a completely separate HG SSH configuration to a GIT SSH configuration ? when even they have the same SSH username, SSH hostname and SSH port numbers ?