]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
www: merge dfblob query data
authorEric Wong <e@80x24.org>
Sun, 16 Jun 2024 23:35:30 +0000 (23:35 +0000)
committerEric Wong <e@80x24.org>
Mon, 17 Jun 2024 07:25:29 +0000 (07:25 +0000)
We combine pre and post-image blob OIDs anyways for the #related
query, so there's no need to have separate arrays to store their
intermediate values.  We'll also rename {-qry} to {-qry_dfblob}
in preparation of subject-based searches.

lib/PublicInbox/View.pm
lib/PublicInbox/ViewDiff.pm
lib/PublicInbox/ViewVCS.pm

index cc1ab79a94472daa63dd8a603e7ef38c6913112a..7d83d0b466a9b70f344848e644846e984b1481b1 100644 (file)
@@ -311,7 +311,8 @@ sub eml_entry {
                " <a\nhref=\"${mhref}raw\">raw</a>" .
                " <a\nhref=\"${mhref}#R\">reply</a>";
 
-       delete($ctx->{-qry}) and
+       # points to permalink
+       delete($ctx->{-qry_dfblob}) and
                $rv .= qq[ <a\nhref="${mhref}#related">related</a>];
 
        my $hr;
@@ -824,10 +825,10 @@ sub html_footer {
        my $upfx = '../';
        my (@related, @skel);
        my $foot = '<pre>';
-       my $qry = delete $ctx->{-qry};
-       if ($qry && $ctx->{ibx}->isrch) {
+       my $qry_dfblob = delete $ctx->{-qry_dfblob};
+       if ($qry_dfblob && $ctx->{ibx}->isrch) {
                my $q = ''; # search for either ancestor or descendent patches
-               for (@{$qry->{dfpre}}, @{$qry->{dfpost}}) {
+               for (@$qry_dfblob) {
                        chop if length > 7; # include 1 abbrev "older" patches
                        $q .= "dfblob:$_ ";
                }
index d078c5f98b58c99ed3d5f16d18856dff0291983e..9e85699b5dcf754b0852d319667ca8ce19ab222c 100644 (file)
@@ -135,15 +135,14 @@ sub diff_header ($$$) {
        # no need to capture oid_a and oid_b on add/delete,
        # we just linkify OIDs directly via s///e in conditional
        if ($$x =~ s/$NULL_TO_BLOB/$1 . oid($dctx, $spfx, $2)/e) {
-               push @{$ctx->{-qry}->{dfpost}}, $2;
+               push @{$ctx->{-qry_dfblob}}, $2;
        } elsif ($$x =~ s/$BLOB_TO_NULL/'index '.oid($dctx, $spfx, $1).$2/e) {
-               push @{$ctx->{-qry}->{dfpre}}, $1;
+               push @{$ctx->{-qry_dfblob}}, $1;
        } elsif ($$x =~ $BLOB_TO_BLOB) {
                # modification-only, not add/delete:
                # linkify hunk headers later using oid_a and oid_b
                @$dctx{qw(oid_a oid_b)} = ($1, $2);
-               push @{$ctx->{-qry}->{dfpre}}, $1;
-               push @{$ctx->{-qry}->{dfpost}}, $2;
+               push @{$ctx->{-qry_dfblob}}, $1, $2;
        } else {
                warn "BUG? <$$x> had no ^index line";
        }
index 83a836986efdcdf29d64ba1433292b2a6d15ff49..b8ff671766a93a041abfd88164ddc58c5a2622c5 100644 (file)
@@ -291,9 +291,9 @@ EOM
                # TODO: should there be another textarea which attempts to
                # search for the exact email which was applied to make this
                # commit?
-               if (my $qry = delete $ctx->{-qry}) {
+               if (my $qry_dfblob = delete $ctx->{-qry_dfblob}) {
                        my $q = '';
-                       for (@{$qry->{dfpost}}, @{$qry->{dfpre}}) {
+                       for (@$qry_dfblob) {
                                # keep blobs as short as reasonable, emails
                                # are going to be older than what's in git
                                substr($_, 7, 64, '');