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

Fix dcommit, rebase when rewriteRoot is in use

When the rewriteRoot setting is used with git-svn, it causes the svn IDs added to commit messages to bear a different URL than is actually used to retrieve Subversion data. It is common for Subversion repositories to be available multiple ways: for instance, HTTP to the public, and svn+ssh to people with commit access. The need to switch URLs for access is fairly common as well -- perhaps someone was just given commit access. To switch URLs without having to rewrite history, one can use the old url as a rewriteRoot, and use the new one in the svn-remote url setting. This works well for svn fetching and general git commands. However, git-svn dcommit, rebase, and perhaps other commands do not work in this scenario. They scan the svn ID lines in commit messages and attempt to match them up with url lines in [svn-remote] sections in the git config. This patch allows them to match rewriteRoot options, if such options are present. Signed-off-by: John Goerzen <jgoerzen@complete.org> Acked-by: Eric Wong <normalperson@yhbt.net>

John Goerzen committed Mar 8, 2008 at 16:04 UTC 0bb91d9a6283661c32878f93a601828cac58d2d6
1 file changed +6 -1
git-svn.perl
+6 -1
@@ -1535,9 +1535,14 @@ sub find_by_url { # repos_root and, path are optional
1535 $remotes->{$repo_id}->{$_});
1536 }
1537 my $p = $path;
1538 + my $rwr = rewrite_root({repo_id => $repo_id});
1539 unless (defined $p) {
1540 $p = $full_url;
1540 - $p =~ s#^\Q$u\E(?:/|$)## or next;
1541 + my $z = $u;
1542 + if ($rwr) {
1543 + $z = $rwr;
1544 + }
1545 + $p =~ s#^\Q$z\E(?:/|$)## or next;
1546 }
1547 foreach my $f (keys %$fetch) {
1548 next if $f ne $p;