+ # ensure prefixed mount full clones work:
+ $td = start_script([@$cmd, $psgi], $env, { 3 => $sock });
+ my $opt = { 2 => \(my $clone_err = '') };
+ ok(run_script(['-clone', "http://$host:$port/pfx", "$tmpdir/pfx" ],
+ undef, $opt), 'pfx clone w/pfx') or diag "clone_err=$clone_err";
+
+ open my $mh, '<', "$tmpdir/pfx/manifest.js.gz" or xbail "open: $!";
+ gunzip(\(do { local $/; <$mh> }) => \(my $mjs = ''));
+ my $mf = $json->decode($mjs);
+ is_deeply([sort keys %$mf], [ qw(/alt /bare /v2/git/0.git
+ /v2/git/1.git /v2/git/2.git) ],
+ 'manifest saved');
+ for (keys %$mf) { ok(-d "$tmpdir/pfx$_", "pfx/$_ cloned") }
+
+ $clone_err = '';
+ ok(run_script(['-clone', '--include=*/alt',
+ "http://$host:$port/pfx", "$tmpdir/incl" ],
+ undef, $opt), 'clone w/include') or diag "clone_err=$clone_err";
+ ok(-d "$tmpdir/incl/alt", 'alt cloned');
+ ok(!-d "$tmpdir/incl/v2" && !-d "$tmpdir/incl/bare", 'only alt cloned');
+ is(xqx([qw(git config -f), "$tmpdir/incl/alt/config", 'gitweb.owner']),
+ "lorelei \xc4\x80\n", 'gitweb.owner set by -clone');
+
+ $clone_err = '';
+ ok(run_script(['-clone', '--dry-run',
+ "http://$host:$port/pfx", "$tmpdir/dry-run" ],
+ undef, $opt), 'clone --dry-run') or diag "clone_err=$clone_err";
+ ok(!-d "$tmpdir/dry-run", 'nothing cloned with --dry-run');
+
+ undef $td;
+
+ open $mh, '<', "$tmpdir/incl/manifest.js.gz" or xbail "open: $!";
+ gunzip(\(do { local $/; <$mh> }) => \($mjs = ''));
+ $mf = $json->decode($mjs);
+ is_deeply([keys %$mf], [ '/alt' ], 'excluded keys skipped in manifest');
+
+ $td = start_script($cmd, $env, { 3 => $sock });
+
+ # default publicinboxGrokManifest match=domain default
+ tiny_test($json, $host, $port);
+
+ # normal full clone on /
+ $clone_err = '';
+ ok(run_script(['-clone', "http://$host:$port/", "$tmpdir/full" ],
+ undef, $opt), 'full clone') or diag "clone_err=$clone_err";
+ ok(-d "$tmpdir/full/$_", "$_ cloned") for qw(alt v2 bare);
+
+ undef $td;
+
+ print $fh <<"" or xbail "print $!";
+[publicinbox]
+ wwwlisting = all
+
+ close $fh or xbail "close $!";
+ $td = start_script($cmd, $env, { 3 => $sock });
+ undef $sock;
+ tiny_test($json, $host, $port, 1);
+
+ # grok-pull sleeps a long while some places:
+ # https://lore.kernel.org/tools/20211013110344.GA10632@dcvr/
+ skip 'TEST_GROK unset', 12 unless $ENV{TEST_GROK};
+ my $grok_pull = require_cmd('grok-pull', 1) or
+ skip('grok-pull not available', 12);
+ my ($grok_version) = (xqx([$grok_pull, "--version"])
+ =~ /(\d+)\.(?:\d+)(?:\.(\d+))?/);
+ $grok_version >= 2 or
+ skip('grok-pull v2 or later not available', 12);
+ my $grok_loglevel = $ENV{TEST_GROK_LOGLEVEL} // 'info';