From: Eric Wong Date: Sun, 16 Jun 2024 23:35:30 +0000 (+0000) Subject: www: merge dfblob query data X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ecd48d3f8b134153585b6615f77a73e38cdb4f0;p=thirdparty%2Fpublic-inbox.git www: merge dfblob query data 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. --- diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index cc1ab79a9..7d83d0b46 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -311,7 +311,8 @@ sub eml_entry { " raw" . " reply"; - delete($ctx->{-qry}) and + # points to permalink + delete($ctx->{-qry_dfblob}) and $rv .= qq[ related]; my $hr; @@ -824,10 +825,10 @@ sub html_footer { my $upfx = '../'; my (@related, @skel); my $foot = '
';
-	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:$_ ";
 		}
diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm
index d078c5f98..9e85699b5 100644
--- a/lib/PublicInbox/ViewDiff.pm
+++ b/lib/PublicInbox/ViewDiff.pm
@@ -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";
 	}
diff --git a/lib/PublicInbox/ViewVCS.pm b/lib/PublicInbox/ViewVCS.pm
index 83a836986..b8ff67176 100644
--- a/lib/PublicInbox/ViewVCS.pm
+++ b/lib/PublicInbox/ViewVCS.pm
@@ -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, '');