@matheusbsbs / matheus-bagliano / commits / b3e9593627
Fork 0

git svn: allow uppercase UUIDs from SVN

SVN allows uppercase A-F characters in repositories. Although `svnadmin' does not create UUIDs with uppercase by default, it is possible to change the UUID of a SVN repository and SVN itself will make no attempt to normalize them. Thanks to Esben Skovenborg for discovering this issue. Signed-off-by: Eric Wong <normalperson@yhbt.net>

Eric Wong committed Jul 11, 2009 at 14:13 UTC b3e95936274a7f5d516e7c37b39e1a56b2d09709
1 file changed +7 -7
git-svn.perl
+7 -7
@@ -1359,11 +1359,11 @@ sub read_repo_config {
1359 sub extract_metadata {
1360 my $id = shift or return (undef, undef, undef);
1361 my ($url, $rev, $uuid) = ($id =~ /^\s*git-svn-id:\s+(.*)\@(\d+)
1362 - \s([a-f\d\-]+)$/x);
1362 + \s([a-f\d\-]+)$/ix);
1363 if (!defined $rev || !$uuid || !$url) {
1364 # some of the original repositories I made had
1365 # identifiers like this:
1366 - ($rev, $uuid) = ($id =~/^\s*git-svn-id:\s(\d+)\@([a-f\d\-]+)/);
1366 + ($rev, $uuid) = ($id =~/^\s*git-svn-id:\s(\d+)\@([a-f\d\-]+)/i);
1367 }
1368 return ($url, $rev, $uuid);
1369 }
@@ -2010,7 +2010,7 @@ sub _set_svm_vars {
2010
2011 chomp($src, $uuid);
2012
2013 - $uuid =~ m{^[0-9a-f\-]{30,}$}
2013 + $uuid =~ m{^[0-9a-f\-]{30,}$}i
2014 or die "doesn't look right - svm:uuid is '$uuid'\n";
2015
2016 # the '!' is used to mark the repos_root!/relative/path
@@ -2096,7 +2096,7 @@ sub svnsync {
2096 die "doesn't look right - svn:sync-from-url is '$url'\n";
2097
2098 my $uuid = tmp_config('--get', "$section.svnsync-uuid");
2099 - ($uuid) = ($uuid =~ m{^([0-9a-f\-]{30,})$}) or
2099 + ($uuid) = ($uuid =~ m{^([0-9a-f\-]{30,})$}i) or
2100 die "doesn't look right - svn:sync-from-uuid is '$uuid'\n";
2101
2102 $svnsync = { url => $url, uuid => $uuid }
@@ -2114,7 +2114,7 @@ sub svnsync {
2114 die "doesn't look right - svn:sync-from-url is '$url'\n";
2115
2116 my $uuid = $rp->{'svn:sync-from-uuid'} or die $err . "uuid\n";
2117 - ($uuid) = ($uuid =~ m{^([0-9a-f\-]{30,})$}) or
2117 + ($uuid) = ($uuid =~ m{^([0-9a-f\-]{30,})$}i) or
2118 die "doesn't look right - svn:sync-from-uuid is '$uuid'\n";
2119
2120 my $section = "svn-remote.$self->{repo_id}";
@@ -2130,7 +2130,7 @@ sub ra_uuid {
2130 unless ($self->{ra_uuid}) {
2131 my $key = "svn-remote.$self->{repo_id}.uuid";
2132 my $uuid = eval { tmp_config('--get', $key) };
2133 - if (!$@ && $uuid && $uuid =~ /^([a-f\d\-]{30,})$/) {
2133 + if (!$@ && $uuid && $uuid =~ /^([a-f\d\-]{30,})$/i) {
2134 $self->{ra_uuid} = $uuid;
2135 } else {
2136 die "ra_uuid called without URL\n" unless $self->{url};
@@ -2848,7 +2848,7 @@ sub make_log_entry {
2848 die "Can't have both 'useSvmProps' and 'rewriteRoot' ",
2849 "options set!\n";
2850 }
2851 - my ($uuid, $r) = $headrev =~ m{^([a-f\d\-]{30,}):(\d+)$};
2851 + my ($uuid, $r) = $headrev =~ m{^([a-f\d\-]{30,}):(\d+)$}i;
2852 # we don't want "SVM: initializing mirror for junk" ...
2853 return undef if $r == 0;
2854 my $svm = $self->svm;