about summary refs log tree commit homepage
path: root/lib/PublicInbox/SolverGit.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-08-29 09:26:43 +0000
committerEric Wong <e@80x24.org>2022-08-29 19:05:53 +0000
commit6f5b238bae5c88b2b9b2fdf7834e17e78a33abd2 (patch)
tree860ce809760fd48e67d24289592b3f83cdd246b1 /lib/PublicInbox/SolverGit.pm
parent0c116643db4047f5af74bdc2b8dbc0630089d504 (diff)
downloadpublic-inbox-6f5b238bae5c88b2b9b2fdf7834e17e78a33abd2.tar.gz
Hints fields can change, so we'll use a simple boolean rather
than checking a static count.  We'll also short-circuit out
reliably regardless of hints when a full OID is given.
Diffstat (limited to 'lib/PublicInbox/SolverGit.pm')
-rw-r--r--lib/PublicInbox/SolverGit.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm
index 52dfaf3d..1e96d042 100644
--- a/lib/PublicInbox/SolverGit.pm
+++ b/lib/PublicInbox/SolverGit.pm
@@ -81,9 +81,8 @@ sub solve_existing ($$) {
         my $oid_b = $want->{oid_b};
         my ($oid_full, $type, $size) = $git->check($oid_b);
 
-        # other than {oid_b, try_gits, try_ibxs}
-        my $have_hints = scalar keys %$want > 3;
-        if (defined($type) && (!$have_hints || $type eq 'blob')) {
+        if ($oid_b eq ($oid_full // '') || (defined($type) &&
+-                                (!$self->{have_hints} || $type eq 'blob'))) {
                 delete $want->{try_gits};
                 return [ $git, $oid_full, $type, int($size) ]; # done, success
         }
@@ -683,6 +682,7 @@ sub solve ($$$$$) {
         $self->{seen_oid} = {};
         $self->{tot} = 0;
         $self->{psgi_env} = $env;
+        $self->{have_hints} = 1 if scalar keys %$hints;
         $self->{todo} = [ { %$hints, oid_b => $oid_want } ];
         $self->{patches} = []; # [ $di, $di, ... ]
         $self->{found} = {}; # { abbr => [ ::Git, oid, type, size, $di ] }