=head1 NAME

public-inbox-fetch - "git fetch" wrapper for v2 inbox mirrors

=head1 SYNOPSIS

public-inbox-fetch [--exit-code] -C INBOX_DIR

=head1 DESCRIPTION

public-inbox-fetch updates git storage of public-inbox mirrors.
With v2 inboxes, it allows detection of new epochs and avoids
unnecessary traffic on old epochs.

public-inbox-fetch does not use nor require any configuration
files of its own.

It does not run L<public-inbox-index(1)>, making it suitable
for maintaining git-only backups.

For v2 inboxes, it will maintain C<$INBOX_DIR/manifest.js.gz>
file to speed up future invocations.  It always safe to remove
manifest.js.gz, it is merely an optimization and will be
restored on the next invocation.

To prevent fetches on any v2 epoch, use L<chmod(1)> to remove
write permissions to the top-level of the epoch.  For example,
to disable fetches on epoch 4:

	chmod a-w $INBOX_DIR/git/4.git

If you wish to re-enable fetches to the epoch:

	chmod u+w $INBOX_DIR/git/4.git

=head1 OPTIONS

=over

=item -q

=item --quiet

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
shell scripts to avoid invoking L<public-inbox-index(1)> when
there are no updates:

	public-inbox-fetch -q --exit-code && public-inbox-index
	test $? -eq 0 || exit $?

=item -p

=item --prune

Pass the C<--prune> and C<--prune-tags> flags to L<git-fetch(1)> calls.

This is a new option in public-inbox 2.0+

=item -v

=item --verbose

Increases verbosity, also passed to L<git-fetch(1)>.

=item --torsocks=auto|no|yes

=item --no-torsocks

Whether to wrap L<git(1)> and L<curl(1)> commands with L<torsocks(1)>.

Default: C<auto>

=back

=head1 EXIT CODES

=over

=item 127

no updates when L</--exit-code> is used above

=back

public-inbox-fetch will also exit with curl L<curl(1)/EXIT CODES>
as documented in the L<curl(1)> manpage (e.g. C<7> when curl cannot
reach a host).  Likewise, L<git-fetch(1)> failures are also
propagated to the user.

=head1 CONTACT

Feedback welcome via plain-text mail to L<mailto:meta@public-inbox.org>

The mail archives are hosted at L<https://public-inbox.org/meta/> and
L<http://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/meta/>

=head1 COPYRIGHT

Copyright all contributors L<mailto:meta@public-inbox.org>

License: AGPL-3.0+ L<https://www.gnu.org/licenses/agpl-3.0.txt>

=head1 SEE ALSO

L<public-inbox-index(1)>, L<curl(1)>
