diff options
author | Eric Wong <e@80x24.org> | 2024-01-31 10:20:16 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2024-02-01 21:00:14 +0000 |
commit | bfb3de41aae23bb65afc62c228570b4a9578abcc (patch) | |
tree | 7815b0b37c2c89a703f5383fd5a38e19c5eac8a6 | |
parent | 82442ae358c8154f4ea05947d39a36cb05ff84bc (diff) | |
download | public-inbox-bfb3de41aae23bb65afc62c228570b4a9578abcc.tar.gz |
LeiToMail can't sort v2 output, but sorting MH input (and NNTP spool + mlmmj archives) numerically makes sense.
-rw-r--r-- | lib/PublicInbox/LeiConvert.pm | 1 | ||||
-rw-r--r-- | lib/PublicInbox/LeiToMail.pm | 2 | ||||
-rw-r--r-- | t/mh_reader.t | 9 |
3 files changed, 11 insertions, 1 deletions
diff --git a/lib/PublicInbox/LeiConvert.pm b/lib/PublicInbox/LeiConvert.pm index 17a952f2..4d4fceb2 100644 --- a/lib/PublicInbox/LeiConvert.pm +++ b/lib/PublicInbox/LeiConvert.pm @@ -52,6 +52,7 @@ sub lei_convert { # the main "lei convert" method my ($lei, @inputs) = @_; $lei->{opt}->{kw} //= 1; $lei->{opt}->{dedupe} //= 'none'; + $lei->{input_opt}->{sort} = 1; # for LeiToMail conflict check my $self = bless {}, __PACKAGE__; my $ovv = PublicInbox::LeiOverview->new($lei, 'out-format'); $lei->{l2m} or return diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm index 9197bb44..a816df6c 100644 --- a/lib/PublicInbox/LeiToMail.pm +++ b/lib/PublicInbox/LeiToMail.pm @@ -451,6 +451,8 @@ EOM (-d $dst || (-e _ && !-w _)) and die "$dst exists and is not a writable file\n"; } + $lei->{input_opt} and # lei_convert sets this + @conflict = grep { !$lei->{input_opt}->{$_} } @conflict; my @err = map { defined($lei->{opt}->{$_}) ? "--$_" : () } @conflict; die "@err incompatible with $fmt\n" if @err; $self->{dst} = $dst; diff --git a/t/mh_reader.t b/t/mh_reader.t index e8f69fa8..711fc8aa 100644 --- a/t/mh_reader.t +++ b/t/mh_reader.t @@ -101,7 +101,14 @@ test_lei(sub { lei_ok qw(index), 'mh:'.$stale; lei qw(q -f mboxrd), 's:msg 4'; like $lei_out, qr/^Subject: msg 4\nStatus: RO\n\n\n/ms, - "message retrieved after `lei index'" + "message retrieved after `lei index'"; + + # ensure sort works for _input_ when output disallows sort + my $v2out = "$ENV{HOME}/v2-out"; + lei_ok qw(convert -s sequence), "mh:$for_sort", '-o', "v2:$v2out"; + my $git = PublicInbox::Git->new("$v2out/git/0.git"); + chomp(my @l = $git->qx(qw(log --pretty=oneline --format=%s))); + is_xdeeply \@l, [1, 22, 333], 'sequence order preserved for v2'; }); done_testing; |