Skip to content

Commit

Permalink
Fix dcommit, rebase when rewriteRoot is in use
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
John Goerzen authored and Junio C Hamano committed Mar 9, 2008
1 parent 655e851 commit 0bb91d9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -1535,9 +1535,14 @@ sub find_by_url { # repos_root and, path are optional
$remotes->{$repo_id}->{$_});
}
my $p = $path;
my $rwr = rewrite_root({repo_id => $repo_id});
unless (defined $p) {
$p = $full_url;
$p =~ s#^\Q$u\E(?:/|$)## or next;
my $z = $u;
if ($rwr) {
$z = $rwr;
}
$p =~ s#^\Q$z\E(?:/|$)## or next;
}
foreach my $f (keys %$fetch) {
next if $f ne $p;
Expand Down

0 comments on commit 0bb91d9

Please sign in to comment.