about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2024-01-31 10:20:20 +0000
committerEric Wong <e@80x24.org>2024-02-01 21:00:17 +0000
commit58fea974d2857c69e15d974cb62f8cabeeb32792 (patch)
treeb5142e86fe89775253fdc15af6a6e3efaaa6822f /lib
parent11694c6d0bc3cdabf2bfeb9acc0f0a810ac1667f (diff)
downloadpublic-inbox-58fea974d2857c69e15d974cb62f8cabeeb32792.tar.gz
MH sequence numbers can be analogous to IMAP UIDs and NNTP
article numbers (or more like IMAP MSNs with clients which
pack).  In any case, sort then numerically by default to avoid
surprising users who treat NNTP spools and mlmmj archives as MH
folders.  This gives more coherent git history and resulting
NNTP/IMAP numbering when round-tripping MH -> v2 -> (NNTP|IMAP) -> MH
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/LeiInput.pm2
-rw-r--r--lib/PublicInbox/MHreader.pm3
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/PublicInbox/LeiInput.pm b/lib/PublicInbox/LeiInput.pm
index 947a7a79..d003d983 100644
--- a/lib/PublicInbox/LeiInput.pm
+++ b/lib/PublicInbox/LeiInput.pm
@@ -242,7 +242,7 @@ sub input_path_url {
                 }
         } elsif (-d _ && $ifmt eq 'mh') {
                 my $mhr = PublicInbox::MHreader->new($input.'/', $lei->{3});
-                $mhr->{sort} = $lei->{opt}->{sort};
+                $mhr->{sort} = $lei->{opt}->{sort} // [ 'sequence'];
                 $mhr->mh_each_eml($self->can('input_mh_cb'), $self, @args);
         } elsif (-d _ && $ifmt =~ /\A(?:v1|v2)\z/) {
                 my $ibx = PublicInbox::Inbox->new({inboxdir => $input});
diff --git a/lib/PublicInbox/MHreader.pm b/lib/PublicInbox/MHreader.pm
index 033aa740..3e7bbd5c 100644
--- a/lib/PublicInbox/MHreader.pm
+++ b/lib/PublicInbox/MHreader.pm
@@ -54,7 +54,8 @@ sub mh_each_file {
         opendir(my $dh, my $dir = $self->{dir});
         my $restore = PublicInbox::OnDestroy->new($$, \&chdir, $self->{cwdfh});
         chdir($dh);
-        if (defined(my $sort = $self->{sort})) {
+        my $sort = $self->{sort};
+        if (defined $sort && "@$sort" ne 'none') {
                 my @sort = map {
                         my @tmp = $_ eq '' ? ('sequence') : split(/[, ]/);
                         # sorting by name alphabetically makes no sense for MH: