Skip to contentSkip to conversation

git-svn: Ignore usernames in URLs in find_by_url

PATCH In review Adam Roben 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore

Adam Roben

author
#0 lore raw

PATCH 1/1 git-svn: Ignore usernames in URLs in find_by_url

Usernames don't matter for the purposes of find_by_url, so always remove them before doing any comparisons.

---
 git-svn.perl |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
git-svn.perl +3 -0
index 90f3bc1..59008cc 100755
@@ -1064,6 +1064,8 @@ sub init_remote_config {
 
 sub find_by_url { # repos_root and, path are optional
 	my ($class, $full_url, $repos_root, $path) = @_;
+	remove_username($full_url);
+	remove_username($repos_root) if defined $repos_root;
 	return undef unless defined $full_url;
 	my $remotes = read_all_remotes();
 	if (defined $full_url && defined $repos_root && !defined $path) {
@@ -1072,6 +1074,7 @@ sub find_by_url { # repos_root and, path are optional
 	}
 	foreach my $repo_id (keys %$remotes) {
 		my $u = $remotes->{$repo_id}->{url} or next;
+		remove_username($u);
 		next if defined $repos_root && $repos_root ne $u;
 
 		my $fetch = $remotes->{$repo_id}->{fetch} || {};
Signature · 1 line
1.5.2.rc0.16.ge10ca-dirty
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Adam Roben

Usernames don't matter for the purposes of find_by_url, so always remove them before doing any comparisons.

---
 git-svn.perl |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
git-svn.perl +0 -0
index 90f3bc1..59008cc 100755

git-svn.perl sub init_remote_config { · line 1069

Quoted 6 lines
git-svn.perl +2 -0
@@ -1064,6 +1064,8 @@ sub init_remote_config {
 
 sub find_by_url { # repos_root and, path are optional
 	my ($class, $full_url, $repos_root, $path) = @_;
+	remove_username($full_url);
+	remove_username($repos_root) if defined $repos_root;
 	return undef unless defined $full_url;

^-- this line should probably be moved up

Otherwise,

Quoted 12 lines
git-svn.perl +1 -0
 	my $remotes = read_all_remotes();
 	if (defined $full_url && defined $repos_root && !defined $path) {
@@ -1072,6 +1074,7 @@ sub find_by_url { # repos_root and, path are optional
 	}
 	foreach my $repo_id (keys %$remotes) {
 		my $u = $remotes->{$repo_id}->{url} or next;
+		remove_username($u);
 		next if defined $repos_root && $repos_root ne $u;
 
 		my $fetch = $remotes->{$repo_id}->{fetch} || {};
Signature · 1 line
1.5.2.rc0.16.ge10ca-dirty
Signature · 1 line
Eric Wong