Skip to contentSkip to conversation

svn: Quote repository root in regex match

PATCH In review Ted Percival 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 svn: Quote repository root in regex match

Fixes a problem matching repository URLs, especially those with a '+' in the URL, such as svn+ssh:// URLs. Parts of the URL were interpreted as special characters by the regex matching.

---
 git-svn.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
git-svn.perl +2 -2
index 351e743..4e95450 100755
@@ -629,7 +629,7 @@ sub populate_merge_info {
 				fatal "merge commit $d has ancestor $parent, but that change "
                      ."does not have git-svn metadata!";
 			}
-			unless ($branchurl =~ /^$rooturl(.*)/) {
+			unless ($branchurl =~ /^\Q$rooturl\E(.*)/) {
 				fatal "commit $parent git-svn metadata changed mid-run!";
 			}
 			my $branchpath = $1;
@@ -791,7 +791,7 @@ sub cmd_dcommit {
 							 ."has uuid $uuid!";
 					}
 
-					unless ($branchurl =~ /^$rooturl(.*)/) {
+					unless ($branchurl =~ /^\Q$rooturl\E(.*)/) {
 						# This branch is very strange indeed.
 						fatal "merge parent $parent for $d is on branch "
 							 ."$branchurl, which is not under the "
Signature · 1 line
1.7.7
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Ted Percival

Fixes a problem matching repository URLs, especially those with a '+' in the URL, such as svn+ssh:// URLs. Parts of the URL were interpreted as special characters by the regex matching.

Looks obviously correct to me, thanks

And pushed to master of git://bogomips.org/git-svn.git
(commit 0e7e30f5606b48a4c6d34bc99c6d680bb76d3fbc)