+# PSGI mount prefixes and manifest.js.gz prefixes don't always align...
+# TODO: remove, handle multi-inbox fetch
+sub deduce_epochs ($$) {
+ my ($m, $path) = @_;
+ my ($v1_ent, @v2_epochs);
+ my $path_pfx = '';
+ $path =~ s!/+\z!!;
+ do {
+ $v1_ent = $m->{$path};
+ @v2_epochs = grep(m!\A\Q$path\E/git/[0-9]+\.git\z!, keys %$m);
+ } while (!defined($v1_ent) && !@v2_epochs &&
+ $path =~ s!\A(/[^/]+)/!/! and $path_pfx .= $1);
+ ($path_pfx, $v1_ent ? $path : undef, @v2_epochs);
+}
+