Skip to contentSkip to conversation

If deriving SVN_SSH from GIT_SSH on msys, also add quotes

PATCH In review Sebastian Schuberth 3 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 If deriving SVN_SSH from GIT_SSH on msys, also add quotes

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

---
 git-svn.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
git-svn.perl +1 -0
index 650c9e5..ef39a9f 100755
@@ -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"/;
 		}
 	}
 }
Signature · 1 line
1.6.6.265.ga0f40
#1 lore raw

Heya,

Quoted 1 line · Sebastian Schuberth

spaces. As GIT_SSH will not work if it contains quotes, it is save to

s/save/safe/

Signature · 3 lines
Cheers,

Sverre Rabbelier
#2 lore raw

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

---
 git-svn.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
git-svn.perl +1 -0
index 650c9e5..ef39a9f 100755
@@ -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"/;
 		}
 	}
 }
Signature · 1 line
1.6.6.265.ga0f40
#3 lore raw
Quoted 10 lines · Sebastian Schuberth

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

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?

Quoted 18 lines
---
 git-svn.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
git-svn.perl +1 -0
index 650c9e5..ef39a9f 100755
@@ -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"/;
 		}
 	}
 }
Signature · 1 line
1.6.6.265.ga0f40
#4 lore raw
Quoted 8 lines · Junio C Hamano
Quoted 4 lines

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

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

Signature · 1 line
Sebastian Schuberth