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.
---
 lib/PublicInbox/SolverGit.pm | 6 +++---
 1 file 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 ] }

Reply via email to