From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 220951FD56 for ; Sun, 2 Feb 2020 06:52:24 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 7/9] convert: fix --no-index switch Date: Sun, 2 Feb 2020 06:52:20 +0000 Message-Id: <20200202065222.14966-8-e@yhbt.net> In-Reply-To: <20200202065222.14966-1-e@yhbt.net> References: <20200202065222.14966-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: The (currently undocumented) "--no-index" flag did not trigger the V2Writable->done call necessary to make the import successful. Fixes: eea47b676127bcdb ("convert: preserve highwater mark from v1 msgmap") --- script/public-inbox-convert | 6 ++---- t/convert-compact.t | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/script/public-inbox-convert b/script/public-inbox-convert index 281313e0..68b0b31a 100755 --- a/script/public-inbox-convert +++ b/script/public-inbox-convert @@ -151,7 +151,5 @@ if (my $mm = $old->mm) { chop(my $cmt = $epoch0->qx(qw(rev-parse --verify), $head)); $v2w->last_epoch_commit(0, $cmt); } -if ($index) { - $v2w->index_sync({reindex => 1}); - $v2w->done; -} +$v2w->index_sync({reindex => 1}) if $index; +$v2w->done; diff --git a/t/convert-compact.t b/t/convert-compact.t index fc46083b..f56d7817 100644 --- a/t/convert-compact.t +++ b/t/convert-compact.t @@ -76,6 +76,9 @@ my $hwm = do { }; ok(defined($hwm) && $hwm > 0, "highwater mark set #$hwm"); +$cmd = [ '-convert', '--no-index', $ibx->{inboxdir}, "$tmpdir/no-index" ]; +ok(run_script($cmd, undef, $rdr), 'convert --no-index works'); + $cmd = [ '-convert', $ibx->{inboxdir}, "$tmpdir/v2" ]; ok(run_script($cmd, undef, $rdr), 'convert works'); @xdir = glob("$tmpdir/v2/xap*/*");