]> Sergey Matveev's repositories - public-inbox.git/commitdiff
searchidx: skip "delta $N" sections for base-85
authorEric Wong <e@80x24.org>
Tue, 19 Jul 2022 02:36:04 +0000 (02:36 +0000)
committerEric Wong <e@80x24.org>
Tue, 19 Jul 2022 06:54:55 +0000 (06:54 +0000)
I don't deal with binary patches ever, so I failed to notice
binary deltas are supported in addition to the more common
literals.

A quick check of apply.c in git.git confirms "delta" and
"literal" are the only binary patch classes we can expect.

lib/PublicInbox/SearchIdx.pm

index cbfe7816044535c398b3dbe3acb7907ebe19a447..bdb84fc73dacf7bbfb1d463d386cdf466f1749ce 100644 (file)
@@ -263,10 +263,10 @@ sub index_diff ($$$) {
        while (defined($_ = shift @l)) {
                if ($in_diff && /^GIT binary patch/) {
                        push @$xnq, $_;
-                       while (@l && $l[0] =~ /^literal /) {
+                       while (@l && $l[0] =~ /^(?:literal|delta) /) {
                                # TODO allow searching by size range?
                                # allows searching by exact size via:
-                               # "literal $SIZE"
+                               # "literal $SIZE" or "delta $SIZE"
                                push @$xnq, shift(@l);
 
                                # skip base85 and empty lines