Skip to contentSkip to conversation

build_clone: When guessing vcs from url suffix, strip cache info

PATCH New Ian Jackson 1 participant 1 message Jun 5, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build_clone: When guessing vcs from url suffix, strip cache info

We assume that anything not containing /'s after %20' is uninteresting.

---
 Osstest/TestSupport.pm |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
Osstest/TestSupport.pm +10 -7
index 4187b6c..93c8fcf 100644
@@ -1045,13 +1045,16 @@ sub build_clone ($$$$) {
     my $timeout= 4000;
 
     my $vcs = $r{"treevcs_$which"};
-    if (defined $vcs) {
-    } elsif ($tree =~ m/\.hg$/) {
-        $vcs= 'hg';
-    } elsif ($tree =~ m/\.git$/) {
-        $vcs= 'git';
-    } else {
-        die "unknown vcs for $which $tree ";
+    if (!defined $vcs) {
+	my $effurl = $tree;
+	$effurl =~ s#\%20[^/]*$##;
+	if ($effurl =~ m/\.hg$/) {
+	    $vcs= 'hg';
+	} elsif ($effurl =~ m/\.git$/) {
+	    $vcs= 'git';
+	} else {
+	    die "unknown vcs for $which $tree ";
+	}
     }
 
     if ($vcs eq 'hg') {
Signature · 1 line
1.7.10.4