From 4bb77753fbbc30ab396a1b01d70cf65b629b6276 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 2 Feb 2020 06:52:20 +0000 Subject: convert: fix --no-index switch 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*/*"); -- cgit v1.2.3-24-ge0c7