Git development
 help / color / mirror / Atom feed
* [PATCH] GIT_SSH does not override ssh in git-svn
@ 2009-08-17 21:09 Karthik R
  2009-08-17 21:38 ` Johannes Schindelin
  2009-08-17 21:40 ` Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Karthik R @ 2009-08-17 21:09 UTC (permalink / raw)
  To: git



Signed-off-by: Karthik R <karthikr@fastmail.fm>
---

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(-)

diff --git a/git-svn.perl b/git-svn.perl
index b0bfb74..c932b6e 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -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
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] GIT_SSH does not override ssh in git-svn
  2009-08-17 21:09 [PATCH] GIT_SSH does not override ssh in git-svn Karthik R
@ 2009-08-17 21:38 ` Johannes Schindelin
  2009-08-17 21:40 ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2009-08-17 21:38 UTC (permalink / raw)
  To: Karthik R; +Cc: git

Hi,

On Mon, 17 Aug 2009, Karthik R wrote:

> 
> 
> Signed-off-by: Karthik R <karthikr@fastmail.fm>
> ---
> 
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] GIT_SSH does not override ssh in git-svn
  2009-08-17 21:09 [PATCH] GIT_SSH does not override ssh in git-svn Karthik R
  2009-08-17 21:38 ` Johannes Schindelin
@ 2009-08-17 21:40 ` Junio C Hamano
  2009-08-17 22:35   ` Karthik R
  1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2009-08-17 21:40 UTC (permalink / raw)
  To: Karthik R; +Cc: git

Karthik R <karthikr@fastmail.fm> writes:

> +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}) {
        	...

???

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] GIT_SSH does not override ssh in git-svn
  2009-08-17 21:40 ` Junio C Hamano
@ 2009-08-17 22:35   ` Karthik R
  0 siblings, 0 replies; 4+ messages in thread
From: Karthik R @ 2009-08-17 22:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano wrote:
> Karthik R <karthikr@fastmail.fm> writes:
>
>   
>> +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}) {
>         	...
>
> ???
>
>   
>> $Git::SVN::Log::TZ = $ENV{TZ};
>> $ENV{TZ} = 'UTC';
>> $| = 1; # unbuffer STDOUT
>> -- 
>> 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};
+}
+

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-08-17 22:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-17 21:09 [PATCH] GIT_SSH does not override ssh in git-svn Karthik R
2009-08-17 21:38 ` Johannes Schindelin
2009-08-17 21:40 ` Junio C Hamano
2009-08-17 22:35   ` Karthik R

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox