X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-remote.perl;h=f6f283ea4f8b45671b7d9b34687d5d7b8475e8b3;hb=e4cd6c7a20bfc776086817671d58e09060a8079a;hp=576379912793c9740620892cd3ee1cf7d2f18cfe;hpb=35c49eeae7e71e8554f27958a16405397c69b552;p=git.git diff --git a/git-remote.perl b/git-remote.perl index 576379912..f6f283ea4 100755 --- a/git-remote.perl +++ b/git-remote.perl @@ -258,6 +258,7 @@ sub show_remote { if ($info->{'PUSH'}) { my @pushed = map { s|^refs/heads/||; + s|^\+refs/heads/|+|; s|:refs/heads/|:|; $_; } @{$info->{'PUSH'}}; @@ -277,7 +278,9 @@ sub add_remote { for (@$track) { $git->command('config', '--add', "remote.$name.fetch", - "+refs/heads/$_:refs/remotes/$name/$_"); + $opts->{'mirror'} ? + "+refs/$_:refs/$_" : + "+refs/heads/$_:refs/remotes/$name/$_"); } if ($opts->{'fetch'}) { $git->command('fetch', $name); @@ -318,9 +321,21 @@ sub add_usage { exit(1); } +local $VERBOSE = 0; +@ARGV = grep { + if ($_ eq '-v' or $_ eq '--verbose') { + $VERBOSE=1; + 0 + } else { + 1 + } +} @ARGV; + if (!@ARGV) { for (sort keys %$remote) { - print "$_\n"; + print "$_"; + print "\t$remote->{$_}->{URL}" if $VERBOSE; + print "\n"; } } elsif ($ARGV[0] eq 'show') { @@ -396,6 +411,10 @@ elsif ($ARGV[0] eq 'add') { shift @ARGV; next; } + if ($opt eq '--mirror') { + $opts{'mirror'} = 1; + next; + } add_usage(); } if (@ARGV != 3) {