diff options
author | Eric Wong <e@yhbt.net> | 2020-01-26 01:17:42 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-01-27 02:58:06 +0000 |
commit | 227a1d886672767e37cc86a3432952c14eb8a143 (patch) | |
tree | dd4890655f88583a16952c751cf9f4e9e731d224 /lib/PublicInbox/Xapcmd.pm | |
parent | fcfa0d639da338c470f07942da71f78fa65354a1 (diff) | |
download | public-inbox-227a1d886672767e37cc86a3432952c14eb8a143.tar.gz |
inbox: add ->version method
This allows us to simplify version checking by avoiding "//" or "||" operators sprinkled around.
Diffstat (limited to 'lib/PublicInbox/Xapcmd.pm')
-rw-r--r-- | lib/PublicInbox/Xapcmd.pm | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/PublicInbox/Xapcmd.pm b/lib/PublicInbox/Xapcmd.pm index de2ef5c6..19c6ff07 100644 --- a/lib/PublicInbox/Xapcmd.pm +++ b/lib/PublicInbox/Xapcmd.pm @@ -97,7 +97,7 @@ sub runnable_or_die ($) { sub prepare_reindex ($$$) { my ($ibx, $im, $reindex) = @_; - if ($ibx->{version} == 1) { + if ($ibx->version == 1) { my $dir = $ibx->search->xdir(1); my $xdb = $PublicInbox::Search::X{Database}->new($dir); if (my $lc = $xdb->get_metadata('last_commit')) { @@ -173,7 +173,6 @@ sub run { -d $old or die "$old does not exist\n"; my $tmp = {}; - my $v = $ibx->{version} ||= 1; my @q; my $reshard = $opt->{reshard}; if (defined $reshard && $reshard <= 0) { @@ -185,7 +184,7 @@ sub run { # we want temporary directories to be as deep as possible, # so v2 shards can keep "xap$SCHEMA_VERSION" on a separate FS. - if ($v == 1) { + if ($ibx->version == 1) { if (defined $reshard) { warn "--reshard=$reshard ignored for v1 $ibx->{inboxdir}\n"; |