git-svn: don't consider SVN URL usernames significant when comparing
http://foo@blah.com/path is the same as http://blah.com/path, so remove usernames from URLs before storing them in commits, and when reading them from commits. Signed-off-by: Eric Wong <normalperson@yhbt.net>
Sam Vilain committed
Feb 23, 2007 at 12:32 UTC
18ea92bd818d38c808329abf77ee8f1ca156f446
1 file changed
+8
git-svn.perl
+8
@@ -1847,6 +1847,8 @@ sub make_log_entry {
1847
$full_url =~ s#^\Q$svm->{replace}\E(/|$)#$svm->{source}$1# or
1848
die "Failed to replace '$svm->{replace}' with ",
1849
"'$svm->{source}' in $full_url\n";
1850
+ # throw away username for storing in records
1851
+ remove_username($full_url);
1852
$log_entry{metadata} = "$full_url\@$r $uuid";
1853
$log_entry{svm_revision} = $r;
1854
$email ||= "$author\@$uuid"
@@ -1915,12 +1917,14 @@ sub rebuild {
1917
my ($rev_list, $ctx) = command_output_pipe("rev-list", $self->refname);
1918
my $latest;
1919
my $full_url = $self->full_url;
1920
+ remove_username($full_url);
1921
my $svn_uuid;
1922
while (<$rev_list>) {
1923
chomp;
1924
my $c = $_;
1925
die "Non-SHA1: $c\n" unless $c =~ /^$::sha1$/o;
1926
my ($url, $rev, $uuid) = ::cmt_metadata($c);
1927
+ remove_username($url);
1928
1929
# ignore merges (from set-tree)
1930
next if (!defined $rev || !$uuid);
@@ -2094,6 +2098,10 @@ sub uri_encode {
2098
$f
2099
}
2100
2101
+sub remove_username {
2102
+ $_[0] =~ s{^([^:]*://)[^@]+@}{$1};
2103
+}
2104
+
2105
package Git::SVN::Prompt;
2106
use strict;
2107
use warnings;