This allows -fetch to work out-of-the-box on using the
grokmirror 2.x default of "_grokmirror".
Quiets down progress messages, also passed to L<git-fetch(1)>.
Quiets down progress messages, also passed to L<git-fetch(1)>.
+=item -T REMOTE
+
+=item --try-remote REMOTE
+
+Try a given remote name instead of C<origin> or C<_grokmirror>.
+May be specified more than once.
+
+Default: C<origin>, C<_grokmirror>
+
=item --exit-code
Exit with C<127> if no updates are done. This can be used in
=item --exit-code
Exit with C<127> if no updates are done. This can be used in
- my ($lei, $dir) = @_; # TODO: support non-"origin"?
- my $cmd = [ qw(git config remote.origin.url) ];
- my $fh = popen_rd($cmd, undef, { -C => $dir, 2 => $lei->{2} });
- my $url = <$fh>;
- close $fh or return;
- $url =~ s!/*\n!!s;
- $url;
+ my ($lei, $dir) = @_;
+ my $rn = $lei->{opt}->{'try-remote'} // [ 'origin', '_grokmirror' ];
+ for my $r (@$rn) {
+ my $cmd = [ qw(git config), "remote.$r.url" ];
+ my $fh = popen_rd($cmd, undef, { -C => $dir, 2 => $lei->{2} });
+ my $url = <$fh>;
+ close $fh or next;
+ $url =~ s!/*\n!!s;
+ return $url;
+ }
+ undef
}
sub do_manifest ($$$) {
}
sub do_manifest ($$$) {
my ($ibx_uri, @git_dir, @epochs, $mg, @new_epoch, $skip);
if ($ibx_ver == 1) {
my $url = remote_url($lei, $dir) //
my ($ibx_uri, @git_dir, @epochs, $mg, @new_epoch, $skip);
if ($ibx_ver == 1) {
my $url = remote_url($lei, $dir) //
- die "E: $dir missing remote.origin.url\n";
+ die "E: $dir missing remote.*.url\n";
$ibx_uri = URI->new($url);
} else { # v2:
require PublicInbox::MultiGit;
$ibx_uri = URI->new($url);
} else { # v2:
require PublicInbox::MultiGit;
$git_url = $url;
$epoch = $nr;
} else {
$git_url = $url;
$epoch = $nr;
} else {
- warn "W: $edir missing remote.origin.url\n";
+ warn "W: $edir missing remote.*.url\n";
my $pid = spawn([qw(git config -l)], undef,
{ 1 => $lei->{2}, 2 => $lei->{2} });
waitpid($pid, 0);
my $pid = spawn([qw(git config -l)], undef,
{ 1 => $lei->{2}, 2 => $lei->{2} });
waitpid($pid, 0);
--torsocks VAL whether or not to wrap git and curl commands with
torsocks (default: `auto')
Must be one of: `auto', `no' or `yes'
--torsocks VAL whether or not to wrap git and curl commands with
torsocks (default: `auto')
Must be one of: `auto', `no' or `yes'
+ -T NAME Name of remote(s) to try (may be repeated)
+ default: `origin' and `_grokmirror'
--exit-code exit with 127 if no updates
--verbose | -v increase verbosity (may be repeated)
--quiet | -q increase verbosity (may be repeated)
-C DIR chdir to specified directory
EOF
--exit-code exit with 127 if no updates
--verbose | -v increase verbosity (may be repeated)
--quiet | -q increase verbosity (may be repeated)
-C DIR chdir to specified directory
EOF
-GetOptions($opt, qw(help|h quiet|q verbose|v+ C=s@ c=s@
+GetOptions($opt, qw(help|h quiet|q verbose|v+ C=s@ c=s@ try-remote|T=s@
no-torsocks torsocks=s exit-code)) or die $help;
if ($opt->{help}) { print $help; exit };
require PublicInbox::Fetch; # loads Admin
no-torsocks torsocks=s exit-code)) or die $help;
if ($opt->{help}) { print $help; exit };
require PublicInbox::Fetch; # loads Admin