From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 1/3] init: favor --skip-epoch instead of --skip
Date: Thu, 3 Oct 2019 07:21:57 +0000 [thread overview]
Message-ID: <20191003072159.84408-2-e@80x24.org> (raw)
In-Reply-To: <20191003072159.84408-1-e@80x24.org>
Since I intend to add support for --skip-artnum, disambiguating
the long option name makes sense. We'll support --skip
indefinitely for compatibility.
---
script/public-inbox-init | 15 ++++++++-------
t/init.t | 6 +++---
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/script/public-inbox-init b/script/public-inbox-init
index 98aea4bf..39f2a067 100755
--- a/script/public-inbox-init
+++ b/script/public-inbox-init
@@ -20,10 +20,11 @@ sub x { system(@_) and die join(' ', @_). " failed: $?\n" }
sub usage { print STDERR "Usage: $usage\n"; exit 1 }
my $version = undef;
my $indexlevel = undef;
-my $skip;
-my %opts = ( 'V|version=i' => \$version,
- 'L|indexlevel=s' => \$indexlevel,
- 'S|skip=i' => \$skip,
+my $skip_epoch;
+my %opts = (
+ 'V|version=i' => \$version,
+ 'L|indexlevel=s' => \$indexlevel,
+ 'S|skip|skip-epoch=i' => \$skip_epoch,
);
GetOptions(%opts) or usage();
PublicInbox::Admin::indexlevel_ok_or_die($indexlevel) if defined $indexlevel;
@@ -104,8 +105,8 @@ if (-f "$mainrepo/inbox.lock") {
$version = 1 unless defined $version;
-if ($version == 1 && defined $skip) {
- die "--skip is only supported for -V2 repos\n";
+if ($version == 1 && defined $skip_epoch) {
+ die "--skip-epoch is only supported for -V2 repos\n";
}
my $ibx = PublicInbox::Inbox->new({
@@ -117,7 +118,7 @@ my $ibx = PublicInbox::Inbox->new({
});
my $creat_opt = {};
-PublicInbox::InboxWritable->new($ibx, $creat_opt)->init_inbox(0, $skip);
+PublicInbox::InboxWritable->new($ibx, $creat_opt)->init_inbox(0, $skip_epoch);
# needed for git prior to v2.1.0
umask(0077) if defined $perm;
diff --git a/t/init.t b/t/init.t
index e2dd306d..667b09fe 100644
--- a/t/init.t
+++ b/t/init.t
@@ -86,15 +86,15 @@ SKIP: {
for (1..2) {
@cmd = (pi_init, '-V2', '-S1', 'skip1', "$tmpdir/skip1",
qw(http://example.com/skip1 skip1@example.com));
- is(system(@cmd), 0, "--skip 1");
+ is(system(@cmd), 0, "--skip-epoch 1");
my $gits = [ glob("$tmpdir/skip1/git/*.git") ];
is_deeply($gits, ["$tmpdir/skip1/git/1.git"], 'skip OK');
}
- @cmd = (pi_init, '-V2', '--skip=2', 'skip2', "$tmpdir/skip2",
+ @cmd = (pi_init, '-V2', '--skip-epoch=2', 'skip2', "$tmpdir/skip2",
qw(http://example.com/skip2 skip2@example.com));
- is(system(@cmd), 0, "--skip 2");
+ is(system(@cmd), 0, "--skip-epoch 2");
my $gits = [ glob("$tmpdir/skip2/git/*.git") ];
is_deeply($gits, ["$tmpdir/skip2/git/2.git"], 'skipping 2 works, too');
}
--
EW
next prev parent reply other threads:[~2019-10-03 7:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-03 7:21 [PATCH 0/3] init: add manpage and locking Eric Wong
2019-10-03 7:21 ` Eric Wong [this message]
2019-10-03 7:21 ` [PATCH 2/3] doc: add manpage for public-inbox-init(1) Eric Wong
2019-10-03 7:21 ` [PATCH 3/3] init: implement locking Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191003072159.84408-2-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).