+sub clone_all {
+ my ($self, $todo, $m) = @_;
+ # handle no-dependency repos, first
+ for (@{delete($todo->{''}) // []}) {
+ clone_v1($_, 1);
+ return if $self->{lei}->{child_error};
+ }
+ # resolve references, deepest, first:
+ while (scalar keys %$todo) {
+ for my $x (keys %$todo) {
+ # resolve multi-level references
+ while (defined($m->{$x}->{reference})) {
+ $x = $m->{$x}->{reference};
+ }
+ my $y = delete $todo->{$x} // next; # already done
+ for (@$y) {
+ clone_v1($_, 1);
+ return if $self->{lei}->{child_error};
+ }
+ last; # restart %$todo iteration
+ }
+ }
+}
+