about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-12-08 03:54:38 +0000
committerEric Wong <e@80x24.org>2023-12-09 02:03:51 +0000
commit8188164496fcd36aa4fc6ac14a5e4782feace077 (patch)
tree00ed35da1bc263fcb7fa355a34d65c281604d0f0
parent2ebbc92688ec061cefd3ec374f2e4c2937e330f9 (diff)
downloadpublic-inbox-8188164496fcd36aa4fc6ac14a5e4782feace077.tar.gz
Post-image blob OIDs are what solver already works with, and
longer OIDs may not be available in historical mail archives.

`patchid' turns out to be unsuitable since:
1) git's default diff algorithm has changed over time
2) users may use different diff options to improve readability

Of course, we could eventually run `lei rediff' during the index
phase to regenerate patchids, but that's out-of-scope for now
and likely to be too expensive.
-rw-r--r--lib/PublicInbox/CodeSearchIdx.pm18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm
index 967933f2..5d420de2 100644
--- a/lib/PublicInbox/CodeSearchIdx.pm
+++ b/lib/PublicInbox/CodeSearchIdx.pm
@@ -34,9 +34,9 @@
 # The $IBX_OFF here is ephemeral (per-join_data) and NOT related to
 # the `ibx_off' column of `over.sqlite3' for extindex.
 # @ROOT_COMMIT_OID_OFFS is space-delimited
-# In both cases, $PFX is typically the value of the patchid (XDFID) but it
-# can be configured to use any combination of patchid, dfpre, dfpost or
-# dfblob.
+# In both cases, $PFX is typically the value of the 7-(hex)char dfpost
+# XDFPOST but it can be configured to use any combination of patchid,
+# dfpre, dfpost or dfblob.
 #
 # WARNING: this is vulnerable to arbitrary memory usage attacks if we
 # attempt to index or join against malicious coderepos with
@@ -1199,11 +1199,13 @@ sub init_join_prefork ($) {
         require PublicInbox::CidxXapHelperAux;
         require PublicInbox::XapClient;
         my @unknown;
-        my $pfx = $JOIN{prefixes} // 'patchid';
-        for (split /\+/, $pfx) {
-                my $v = $PublicInbox::Search::PATCH_BOOL_COMMON{$_} //
-                        push(@unknown, $_);
-                push(@JOIN_PFX, split(/ /, $v));
+        my $pfx = $JOIN{prefixes} // 'dfpost7';
+        for my $p (split /\+/, $pfx) {
+                my $n = '';
+                $p =~ s/([0-9]+)\z// and $n = $1;
+                my $v = $PublicInbox::Search::PATCH_BOOL_COMMON{$p} //
+                        push(@unknown, $p);
+                push(@JOIN_PFX, map { $_.$n } split(/ /, $v));
         }
         @unknown and die <<EOM;
 E: --join=prefixes= contains unsupported prefixes: @unknown