- my $state;
- my $git = PublicInbox::GitCatFile->new($ctx->{git_dir});
- my (undef, $last) = each_recent_blob($ctx, sub {
- my ($path, $commit) = @_;
- unless (defined $state) {
- $state = [ $ctx->{srch}, {}, $commit, 0 ];
- }
- my $mime = do_cat_mail($git, $_[0]) or return 0;
- my $t = eval { str2time($mime->header('Date')) };
- defined($t) or $t = 0;
- $mime->header_set('X-PI-TS', $t);
- $html .= PublicInbox::View->index_entry($mime, 0, $state);
- 1;
- });
- Email::Address->purge_cache;
- $git = undef; # destroy pipes.
+ 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";
+ }