From 3c499dbc312a7cd32da4664a3cfad6500ab98e8d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 28 Nov 2022 05:31:45 +0000 Subject: [PATCH] clone: flesh out --objstore behavior and document We can support absolute paths to avoid surprising behaviors, but relative paths are preferred since the goal is to be accessible over the "dumb" HTTP git transport (the dumb transport is uses less memory and CPU on the server). --- Documentation/public-inbox-clone.pod | 12 ++++++++++++ lib/PublicInbox/LeiMirror.pm | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Documentation/public-inbox-clone.pod b/Documentation/public-inbox-clone.pod index 1c31fbb3..cee9f76e 100644 --- a/Documentation/public-inbox-clone.pod +++ b/Documentation/public-inbox-clone.pod @@ -6,6 +6,8 @@ public-inbox-clone - "git clone --mirror" wrapper public-inbox-clone INBOX_URL [INBOX_DIR] +public-inbox-clone ROOT_URL [DESTINATION] + =head1 DESCRIPTION public-inbox-clone is a wrapper around C for @@ -82,6 +84,16 @@ Force a remote public-inbox version (must be C<1> or C<2>). This is auto-detected by default, and this option exists mainly for testing. +=item --objstore[=DIR] + +Enables space savings when the remote C +includes C entries as generated by grokmirror 2.x. + +If C is not an absolute path, it is relative to the +C directory. If only C<--objstore> is specified +without C, then C (C<$DESTINATION/objstore>) +is the implied value of C. + =item -n =item --dry-run diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index 6efe23fa..2f96058a 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -882,7 +882,8 @@ sub do_mirror { # via wq_io_do or public-inbox-clone if (defined(my $os = $lei->{opt}->{objstore})) { $os = 'objstore' if $os eq ''; # --objstore w/o args - $self->{-objstore} = "$self->{dst}/$os"; + $os = "$self->{dst}/$os" if $os !~ m!\A/!; + $self->{-objstore} = $os; } local $LIVE; my $iv = $lei->{opt}->{'inbox-version'} // -- 2.44.0