- my @messages;
- my $git_dir = $ctx->{git_dir};
- my $git = PublicInbox::GitCatFile->new($git_dir);
- my ($first, $last) = each_recent_blob($ctx, sub {
- mime_load_for_sort($git, $_[0], \@messages);
- });
- $git = undef; # destroy pipes.
-
- my $th = PublicInbox::Thread->new(@messages);
- $th->thread;
- my $html = "<html><head><title>$title</title>" .
- '<link rel="alternate" title="Atom feed"' . "\nhref=\"" .
- $feed_opts->{atomurl} . "\"\ntype=\"application/atom+xml\"/>" .
- '</head><body>' . PRE_WRAP;
-
- # sort child messages in chronological order
- $th->order(*PublicInbox::Thread::sort_ts);
-
- # except we sort top-level messages reverse chronologically
- my $state = [ $ctx->{srch}, {}, $first, 0 ];
- for (PublicInbox::Thread::rsort_ts($th->rootset)) {
- dump_msg($_, 0, \$html, $state)
+ my $git = $ctx->{git} ||= PublicInbox::Git->new($ctx->{git_dir});
+ foreach my $msg (@{$res->{msgs}}) {
+ add_to_feed($feed_opts, $fh, mid2path($msg->mid), $git);