- 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 $top = "<b>$title</b> (<a\nhref=\"new.atom\">Atom feed</a>)";
+
+ if ($srch) {
+ $top = qq{<form\naction=""><pre>$top} .
+ qq{ <input\nname=q\ntype=text />} .
+ qq{<input\ntype=submit\nvalue=search />} .
+ q{</pre></form><pre>}
+ } else {
+ $top = '<pre>' . $top . "\n";