-}
-
-# recreate $oid_b
-# Returns an array ref: [ ::Git object, oid_full, type, size, di ]
-# or undef if nothing was found.
-sub solve ($$$$) {
- my ($self, $out, $oid_b, $hints) = @_;
-
- # should we even get here? Probably not, but somebody
- # could be manually typing URLs:
- return if $oid_b =~ /\A0+\z/;
-
- my $req = { %$hints, oid_b => $oid_b };
- my @todo = ($req);
- my $found = {}; # { abbrev => [ ::Git, oid_full, type, size, $di ] }
- my $patches = []; # [ array of $di hashes ]
- my $max = $self->{max_patches} || 200;
- my $apply_cb;
- my $cb = sub {
- my $want = pop @todo;
- unless ($want) {
- $apply_cb ||= apply_patches_cb($self, $out, $found,
- $patches, $oid_b);
- return $apply_cb->();
- }
-
- if (scalar(@$patches) > $max) {
- print $out "Aborting, too many steps to $oid_b\n";
- return;
- }
- # see if we can find the blob in an existing git repo:
- my $want_oid = $want->{oid_b};
- if (my $existing = solve_existing($self, $out, $want)) {
- print $out "found $want_oid in ",
- join("\n", $existing->[0]->pub_urls), "\n";
-
- return $existing if $want_oid eq $oid_b; # DONE!
- $found->{$want_oid} = $existing;
- return ''; # ok, one blob resolved, more to go?
- }