}
}
my @subj = $eml->header('Subject');
+ $ctx->{subj_raw} = $subj[0];
$hbuf .= "Subject: $_\n" for @subj;
$title[0] = $subj[0] // '(no subject)';
$hbuf .= "Date: $_\n" for $eml->header('Date');
$ctx->{parent_msg} = $parent;
}
-sub dfqry_text ($) {
- my ($ctx) = @_;
+sub dfqry_text ($$) {
+ my ($ctx, $subj) = @_;
my $qry_dfblob = delete $ctx->{-qry_dfblob} or return (undef);
- my $q = join ' ', map {
+ my @bs = split /["\x{201c}\x{201d}]+/, $subj;
+ my $q = join ' ', (@bs ? ('(') : ()), map {
chop if length > 7; # include 1 abbrev "older" patches
"dfblob:$_";
} @$qry_dfblob;
local $Text::Wrap::columns = COLS;
local $Text::Wrap::huge = 'overflow';
+ $subj //= '';
+ $subj =~ s/\A\s*(?:amend|fixup|squash)\!\s*//; # --autosquash commands
+ # split on double-quotes for phrases
$q = wrap('', '', $q);
+ if (@bs) {
+ $q .= " )\n OR (";
+ $q .= qq[\nbs:"$_"] for @bs;
+ $q .= ' )';
+ }
my $rows = ($q =~ tr/\n/\n/) + 1;
($rows, ascii_html($q));
}
my $upfx = '../';
my (@related, @skel);
my $foot = '<pre>';
- my ($rows, $q) = dfqry_text $ctx;
+ my ($rows, $q) = dfqry_text $ctx,
+ delete($ctx->{-qry_subj}) // $ctx->{subj_raw};
if ($rows && $ctx->{ibx}->isrch) {
$related[0] = <<EOM;
<form id=related
sub flush_diff ($$) {
my ($ctx, $cur) = @_;
+ my ($subj) = ($$cur =~ /^Subject:\s*\[[^\]]+\]\s*(.+?)$/sm);
my @top = split($EXTRACT_DIFFS, $$cur);
undef $$cur; # free memory
-
+ $ctx->{-qry_subj} = $subj if $subj;
my $lnk = $ctx->{-linkify};
my $dctx; # {}, keys: Q, oid_a, oid_b
my $zfh = $ctx->zfh;
title="list contemporary emails">$2</a>)
!e;
- $ctx->{-title_html} = $s = $ctx->{-linkify}->to_html($s);
+ my $title_html = $ctx->{-title_html} = $ctx->{-linkify}->to_html($s);
my ($P, $p, $pt) = delete @$ctx{qw(-cmt_P -cmt_p -cmt_pt)};
$_ = qq(<a href="$upfx$_/s/">).shift(@$p).'</a> '.shift(@$pt) for @$P;
if (@$P == 1) {
author $au
committer $co
-<b>$s</b>
+<b>$title_html</b>
EOM
print $zfh "\n", $ctx->{-linkify}->to_html($bdy) if length($bdy);
undef $bdy; # free memory
# TODO: should there be another textarea which attempts to
# search for the exact email which was applied to make this
# commit?
- my ($rows, $q) = PublicInbox::View::dfqry_text $ctx;
+ my ($rows, $q) = PublicInbox::View::dfqry_text $ctx, $s;
if ($rows) {
my $ibx_url = ibx_url_for($ctx);
my $alt;