From 6393ec8118e7f5481ab476c2d73614c89c64866f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 15 Sep 2021 21:35:55 +0000 Subject: fetch: support --exit-code switch As noted in the new manpage entry, this is useful for avoiding public-inbox-index invocations when there's nothing to update. We use 127 to match "grok-pull", and also because it doesn't conflict with any of the current curl(1) exit codes. --- Documentation/public-inbox-fetch.pod | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'Documentation/public-inbox-fetch.pod') diff --git a/Documentation/public-inbox-fetch.pod b/Documentation/public-inbox-fetch.pod index 7944fdcd..28d5638d 100644 --- a/Documentation/public-inbox-fetch.pod +++ b/Documentation/public-inbox-fetch.pod @@ -4,7 +4,7 @@ public-inbox-fetch - "git fetch" wrapper for v2 inbox mirrors =head1 SYNOPSIS -public-inbox-fetch -C INBOX_DIR +public-inbox-fetch [--exit-code] -C INBOX_DIR =head1 DESCRIPTION @@ -31,6 +31,15 @@ file to speed up future invocations. Quiets down progress messages, also passed to L. +=item --exit-code + +Exit with C<127> if no updates are done. This can be used in +shell scripts to avoid invoking L when +there are no updates: + + public-inbox-fetch -q --exit-code && public-inbox-index + test $? -eq 0 || exit $? + =item -v =item --verbose @@ -45,6 +54,23 @@ Whether to wrap L and L commands with torsocks. Default: C +=back + +=head1 EXIT CODES + +=over + +=item 127 + +no updates when L is used above + +=back + +public-inbox-fetch will also exit with curl L +as documented in the L manpage (e.g. C<7> when curl cannot +reach a host). Likewise, L failures are also +propagated to the user. + =head1 CONTACT Feedback welcome via plain-text mail to L @@ -60,4 +86,4 @@ License: AGPL-3.0+ L =head1 SEE ALSO -L +L, L -- cgit v1.2.3-24-ge0c7