Skip to contentSkip to conversation

GIT_SSH does not override ssh in git-svn

PATCH In review Karthik R 3 participants 4 messages Jun 15, 2016

lore
Share & tools
lore

Karthik R

author
#0 lore raw

PATCH 1/1 GIT_SSH does not override ssh in git-svn

---

Setting GIT_SSH when using "git svn clone svn+ssh://..." does not override the default ssh; SVN_SSH needs to be set instead. Corrected this.

Also, on Windows, SVN_SSH needs to be set with \ escaped
e.g., "C:\\PuTTY\\plink.exe"

See http://code.google.com/p/msysgit/issues/detail?id=305

git-svn.perl | 10 ++++++++++

1 files changed, 10 insertions(+), 0 deletions(-)
git-svn.perl +0 -0
index b0bfb74..c932b6e 100755
@@ -21,6 +21,16 @@ $Git::SVN::default_ref_id = $ENV{GIT_SVN_ID} || 'git-svn';

$Git::SVN::Ra::_log_window_size = 100;
$Git::SVN::_minimize_url = 'unset';

+my $git_ssh_user_set = 1 if defined $ENV{GIT_SSH}; +if ($git_ssh_user_set) {

+       # If GIT_SSH is set, also set SVN_SSH...
+       $ENV{SVN_SSH} = $ENV{GIT_SSH};
+       # ... and escape \s in shell-variable on Windows
+       if ($^O eq 'MSWin32' || $^O eq 'msys') {

+ $ENV{SVN_SSH} =~ s/\\/\\\\/g;
+ }
+}
+
$Git::SVN::Log::TZ = $ENV{TZ};
$ENV{TZ} = 'UTC';
$| = 1; # unbuffer STDOUT

Signature · 1 line
1.5.4.3
#1 lore raw

Review

Quoted 10 lines · Karthik R
(quoted diff) +10 -0
+my $git_ssh_user_set = 1 if defined $ENV{GIT_SSH};
+if ($git_ssh_user_set) {
+       # If GIT_SSH is set, also set SVN_SSH...
+       $ENV{SVN_SSH} = $ENV{GIT_SSH};
+       # ... and escape \s in shell-variable on Windows
+       if ($^O eq 'MSWin32' || $^O eq 'msys') {
+               $ENV{SVN_SSH} =~ s/\\/\\\\/g;
+       }
+}
+

Why not just

	if (defined $ENV{GIT_SSH}) {
        	...

???

Quoted 5 lines

$Git::SVN::Log::TZ = $ENV{TZ};
$ENV{TZ} = 'UTC';
$| = 1; # unbuffer STDOUT

Signature · 1 line
1.5.4.3
author
#2 lore raw
Quoted 17 lines · Junio C Hamano

Review

Quoted 11 lines · Karthik R
(quoted diff) +10 -0
+my $git_ssh_user_set = 1 if defined $ENV{GIT_SSH};
+if ($git_ssh_user_set) {
+       # If GIT_SSH is set, also set SVN_SSH...
+       $ENV{SVN_SSH} = $ENV{GIT_SSH};
+       # ... and escape \s in shell-variable on Windows
+       if ($^O eq 'MSWin32' || $^O eq 'msys') {
+               $ENV{SVN_SSH} =~ s/\\/\\\\/g;
+       }
+}
+

Why not just

Quoted 12 lines
	if (defined $ENV{GIT_SSH}) {
        	...

???

Quoted 6 lines

$Git::SVN::Log::TZ = $ENV{TZ};
$ENV{TZ} = 'UTC';
$| = 1; # unbuffer STDOUT

Signature · 1 line
1.5.4.3

I think I had trouble getting that to work correctly on my Windows XP box... I didn't dig into that (my perl was exactly 1 day old).

Does this look better (it does to me) ? If so, I can resend the patch addressing Dscho's comments too.

+# If GIT_SSH is set, also set SVN_SSH... +$ENV{SVN_SSH} = $ENV{GIT_SSH} if defined $ENV{GIT_SSH}; +# ... and escape \s in shell-variable on Windows +if ($^O eq 'MSWin32' || $^O eq 'msys') {
+ $ENV{SVN_SSH} =~ s/\\/\\\\/g if defined $ENV{SVN_SSH};
+}
+

#3 lore raw
In reply to Karthik R

Hi,

Quoted 5 lines · Karthik R

---

Quoted 7 lines

Setting GIT_SSH when using "git svn clone svn+ssh://..." does not override the default ssh; SVN_SSH needs to be set instead. Corrected this.

Also, on Windows, SVN_SSH needs to be set with \ escaped
e.g., "C:\\PuTTY\\plink.exe"

See http://code.google.com/p/msysgit/issues/detail?id=305

This probably all wants to go into the commit message: it is very useful information!

Besides, I think you would like to formulate the commit subject more
positive: "Respect GIT_SSH in git-svn" or some such. After all, you fix the issue. IOW use the imperative: you command git-svn to behave ;-)

Ciao,
Dscho