# [PATCH] If deriving SVN_SSH from GIT_SSH on msys, also add quotes

5 messages from 2010-01-23 to 2010-01-23. Participants: Sebastian Schuberth, Sverre Rabbelier, Junio C Hamano.
Thread: https://gitlist.dev/t/22356

## Sebastian Schuberth, 2010-01-23 10:22

Subject: [PATCH] If deriving SVN_SSH from GIT_SSH on msys, also add quotes
Message-ID: <4B5ACDD5.8080007@gmail.com>
URL: https://gitlist.dev/e/4B5ACDD5.8080007%40gmail.com

```
In contrast to GIT_SSH, SVN_SSH requires quotes for paths that contain
spaces. As GIT_SSH will not work if it contains quotes, it is save to
assume it never contains quotes. Also, adding quotes to SVN_SSH for paths
that do not contain spaces does no harm. So we always add quotes when
deriving SVN_SSH from GIT_SSH on msys.

This fixes msysGit issue 385, see
http://code.google.com/p/msysgit/issues/detail?id=385

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
---
 git-svn.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 650c9e5..ef39a9f 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -26,6 +26,7 @@ if (! exists $ENV{SVN_SSH}) {
 		$ENV{SVN_SSH} = $ENV{GIT_SSH};
 		if ($^O eq 'msys') {
 			$ENV{SVN_SSH} =~ s/\\/\\\\/g;
+			$ENV{SVN_SSH} =~ s/(.*)/"$1"/;
 		}
 	}
 }
-- 
1.6.6.265.ga0f40

```

## Sverre Rabbelier, 2010-01-23 11:22

Subject: Re: [PATCH] If deriving SVN_SSH from GIT_SSH on msys, also add quotes
Message-ID: <fabb9a1e1001230322t708756fahce326511d3f0bda5@mail.gmail.com>
URL: https://gitlist.dev/e/fabb9a1e1001230322t708756fahce326511d3f0bda5%40mail.gmail.com
In-Reply-To: <4B5ACDD5.8080007@gmail.com>

```
Heya,

On Sat, Jan 23, 2010 at 11:22, Sebastian Schuberth <sschuberth@gmail.com> wrote:
> spaces. As GIT_SSH will not work if it contains quotes, it is save to

s/save/safe/

-- 
Cheers,

Sverre Rabbelier

```

## Sebastian Schuberth, 2010-01-23 14:20

Subject: Re: [PATCH] If deriving SVN_SSH from GIT_SSH on msys, also add quotes
Message-ID: <4B5B05AC.2050200@gmail.com>
URL: https://gitlist.dev/e/4B5B05AC.2050200%40gmail.com
In-Reply-To: <fabb9a1e1001230322t708756fahce326511d3f0bda5@mail.gmail.com>

```
In contrast to GIT_SSH, SVN_SSH requires quotes for paths that contain
spaces. As GIT_SSH will not work if it contains quotes, it is safe to
assume it never contains quotes. Also, adding quotes to SVN_SSH for paths
that do not contain spaces does no harm. So we always add quotes when
deriving SVN_SSH from GIT_SSH.

This fixes msysGit issue 385, see
http://code.google.com/p/msysgit/issues/detail?id=385

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
---
 git-svn.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 650c9e5..ef39a9f 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -26,6 +26,7 @@ if (! exists $ENV{SVN_SSH}) {
 		$ENV{SVN_SSH} = $ENV{GIT_SSH};
 		if ($^O eq 'msys') {
 			$ENV{SVN_SSH} =~ s/\\/\\\\/g;
+			$ENV{SVN_SSH} =~ s/(.*)/"$1"/;
 		}
 	}
 }
-- 
1.6.6.265.ga0f40

```

## Junio C Hamano, 2010-01-23 19:33

Subject: Re: [PATCH] If deriving SVN_SSH from GIT_SSH on msys, also add quotes
Message-ID: <7vd410d3as.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vd410d3as.fsf%40alter.siamese.dyndns.org
In-Reply-To: <4B5B05AC.2050200@gmail.com>

```
Sebastian Schuberth <sschuberth@gmail.com> writes:

> In contrast to GIT_SSH, SVN_SSH requires quotes for paths that contain
> spaces. As GIT_SSH will not work if it contains quotes, it is safe to
> assume it never contains quotes. Also, adding quotes to SVN_SSH for paths
> that do not contain spaces does no harm. So we always add quotes when
> deriving SVN_SSH from GIT_SSH.
>
> This fixes msysGit issue 385, see
> http://code.google.com/p/msysgit/issues/detail?id=385
>
> Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>

As the patch clearly is inside "msys-only" codepath, I don't mind
bypassing Eric and apply this directly to my tree before I tag 1.7.0-rc0,
but may I ask why this quoting magic matters only on msys?

> ---
>  git-svn.perl |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/git-svn.perl b/git-svn.perl
> index 650c9e5..ef39a9f 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -26,6 +26,7 @@ if (! exists $ENV{SVN_SSH}) {
>  		$ENV{SVN_SSH} = $ENV{GIT_SSH};
>  		if ($^O eq 'msys') {
>  			$ENV{SVN_SSH} =~ s/\\/\\\\/g;
> +			$ENV{SVN_SSH} =~ s/(.*)/"$1"/;
>  		}
>  	}
>  }
> -- 
> 1.6.6.265.ga0f40

```

## Sebastian Schuberth, 2010-01-23 20:11

Subject: Re: [PATCH] If deriving SVN_SSH from GIT_SSH on msys, also add quotes
Message-ID: <bdca99241001231211o97aa0eamacc40bf982a9f022@mail.gmail.com>
URL: https://gitlist.dev/e/bdca99241001231211o97aa0eamacc40bf982a9f022%40mail.gmail.com
In-Reply-To: <7vd410d3as.fsf@alter.siamese.dyndns.org>

```
On Sat, Jan 23, 2010 at 20:33, Junio C Hamano <gitster@pobox.com> wrote:

>> This fixes msysGit issue 385, see
>> http://code.google.com/p/msysgit/issues/detail?id=385
>>
>> Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
>
> As the patch clearly is inside "msys-only" codepath, I don't mind
> bypassing Eric and apply this directly to my tree before I tag 1.7.0-rc0,
> but may I ask why this quoting magic matters only on msys?

To be honest, I'm not exactly sure why this is required. Maybe the SVN
Perl module does some different path mangling than a normal MSYS SVN
binary would do. We're already setting SVN_SSH like this (that is,
using double-backslashes and quotes) in the msysGit installer, see the
discussion at [1]. This patch basically just does the same thing for
people that initially chose to not modify the environment during the
msysGit installation, but later change GIT_SSH manually, and forget to
set SVN_SSH, too.

[1] http://code.google.com/p/msysgit/issues/detail?id=305#c8

-- 
Sebastian Schuberth

```
