Skip to contentSkip to conversation

git-remote: do not complain on multiple URLs for a remote

PATCH In review Junio C Hamano 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-remote: do not complain on multiple URLs for a remote

Having more than one URL for a remote is perfectly normal when the remote is defined to push to multiple places. Get rid of the annoying "Warning" message.

---
 git-remote.perl |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
git-remote.perl +3 -3
index 5cd6951..b30ed73 100755
@@ -7,10 +7,10 @@ my $git = Git->repository();
 sub add_remote_config {
 	my ($hash, $name, $what, $value) = @_;
 	if ($what eq 'url') {
-		if (exists $hash->{$name}{'URL'}) {
-			print STDERR "Warning: more than one remote.$name.url\n";
+		# Having more than one is Ok -- it is used for push.
+		if (! exists $hash->{'URL'}) {
+			$hash->{$name}{'URL'} = $value;
 		}
-		$hash->{$name}{'URL'} = $value;
 	}
 	elsif ($what eq 'fetch') {
 		$hash->{$name}{'FETCH'} ||= [];
Signature · 1 line
1.5.4.3.339.gad2d1
#1 lore raw

Hi,

git-remote.perl my $git = Git->repository(); · line 11

Quoted 1 line · Junio C Hamano
git-remote.perl +1 -0
+		if (! exists $hash->{'URL'}) {

Is it preferred style now to add a space after "!"?

BTW I take this patch as a hint that I should resurrect builtin-remote...

Thanks,
Dscho

#2 lore raw
Quoted 7 lines · Johannes Schindelin

Hi,

git-remote.perl my $git = Git->repository(); · line 11

Quoted 1 line · Junio C Hamano
git-remote.perl +1 -0
+		if (! exists $hash->{'URL'}) {

Is it preferred style now to add a space after "!"?

No, just a copied line from another codepath.