- my ($path_pfx, $v1_path, @v2_epochs) = deduce_epochs($m, $path);
- if (@v2_epochs) {
- # It may be possible to have v1 + v2 in parallel someday:
- warn(<<EOM) if defined $v1_path;
-# `$v1_path' appears to be a v1 inbox while v2 epochs exist:
-# @v2_epochs
-# ignoring $v1_path (use --inbox-version=1 to force v1 instead)
+ my ($path_pfx, $n, $multi) = multi_inbox($self, \$path, $m);
+ if (my $v2 = delete $multi->{v2}) {
+ for my $name (sort keys %$v2) {
+ my $epochs = delete $v2->{$name};
+ my %v2_epochs = map {
+ $uri->path($n > 1 ? $path_pfx.$path.$_
+ : $path_pfx.$_);
+ my ($e) = ("$uri" =~ m!/([0-9]+)\.git\z!);
+ $e // die "no [0-9]+\.git in `$uri'";
+ $e => [ $uri->clone, $_ ];
+ } @$epochs;
+ ("$uri" =~ m!\A(.+/)git/[0-9]+\.git\z!) or
+ die "BUG: `$uri' !~ m!/git/[0-9]+.git!";
+ local $self->{cur_src} = $1;
+ local $self->{cur_dst} = $self->{dst};
+ if ($n > 1 && $uri->path =~ m!\A\Q$path_pfx$path\E/(.+)/
+ git/[0-9]+\.git\z!x) {
+ $self->{cur_dst} .= "/$1";
+ }
+ index($self->{cur_dst}, "\n") >= 0 and die <<EOM;
+E: `$self->{cur_dst}' must not contain newline