-sub remote_url ($$) {
- my ($lei, $dir) = @_; # TODO: support non-"origin"?
- my $cmd = [ qw(git config remote.origin.url) ];
- my $fh = popen_rd($cmd, undef, { -C => $dir, 2 => $lei->{2} });
- my $url = <$fh>;
- close $fh or return;
- $url =~ s!/*\n!!s;
- $url;
+# 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);