our $qre = '["'."']?";
# $dispatchdir/distro=DISTRO should contain
-# dgit-live a clone of dgit
+# dgit-live a clone of dgit (only if not using installed vsns)
# diverts
# repos/ } by virtue of
# suites } dgit-repos-server's defaults relating to
# diverts should be list of
# <pat> [<divert-to>]
# where <pat> is a package name pattern which may contain * or literals.
+# <divert-to> is for `git config dgit-distro.DISTRO.diverts.<divert-to>'
our ($distro,$pkg, $d);
our ($dgitlive,$repos,$suites,$diverts,$policyhook,$repo);
my $cmd=$1;
selectpackage $2,$3;
if ($cmd eq 'receive-pack') {
+ $ENV{'PERLLIB'} //= '';
+ $ENV{'PERLLIB'} =~ s#^(?=.)#:#;
+ $ENV{'PERLLIB'} =~ s#^# $ENV{DGIT_TEST_INTREE} // $dgitlive #e;
my $s = "$dgitlive/infra/dgit-repos-server";
+ $s = "dgit-repos-server" if !stat_exists $s;
exec $s, $distro, $d, $authrune, qw(--ssh);
die "exec $s: $!";
} elsif ($cmd eq 'upload-pack') {
m#^${qre}git-upload-pack ${qre}/dgit/($lre)/(?:repos/)?_dgit-repos-server\.git${qre}$#
) {
my $distro= $1;
+ # if running installed packages, source code should come
+ # some other way
serve_up("$dispatchdir/distro=$1/dgit-live/.git");
} elsif (m#^${qre}git-upload-pack\s#) {
die "unknown repo to serve ($_). use dgit, or for server source ".