my $fetch_each_epoch = sub {
my %before = map { $_ => 1 } glob("$tmpdir/m/git/*");
run_script([qw(-fetch --exit-code -q)], undef, {-C => "$tmpdir/m"}) or
my $fetch_each_epoch = sub {
my %before = map { $_ => 1 } glob("$tmpdir/m/git/*");
run_script([qw(-fetch --exit-code -q)], undef, {-C => "$tmpdir/m"}) or
is($?, 0, '--exit-code 0 after fetch updated');
my @after = grep { !$before{$_} } glob("$tmpdir/m/git/*");
push @new_epochs, @after;
is($?, 0, '--exit-code 0 after fetch updated');
my @after = grep { !$before{$_} } glob("$tmpdir/m/git/*");
push @new_epochs, @after;
my @g = glob("$dst/git/*.git");
my @w = grep { -w $_ } @g;
my @r = grep { ! -w $_ } @g;
my @g = glob("$dst/git/*.git");
my @w = grep { -w $_ } @g;
my @r = grep { ! -w $_ } @g;
is(scalar(@w), 1, 'one writable directory');
my ($w) = ($w[0] =~ m!/([0-9]+)\.git\z!);
is((grep {
is(scalar(@w), 1, 'one writable directory');
my ($w) = ($w[0] =~ m!/([0-9]+)\.git\z!);
is((grep {
"http://$host:$port/v2/", $dst]);
my @g2 = glob("$dst/git/*.git") ;
is_deeply(\@g2, \@g, 'cloned again');
"http://$host:$port/v2/", $dst]);
my @g2 = glob("$dst/git/*.git") ;
is_deeply(\@g2, \@g, 'cloned again');
'got one more cloned epoch');
# make 0.git writable and fetch into it, relies on culled manifest
'got one more cloned epoch');
# make 0.git writable and fetch into it, relies on culled manifest
-my $v110 = xqx([qw(git rev-parse v1.1.0-pre1)], undef, { 2 => \$err });
+my $oldrev = '0b3e19584c90d958a723ac2d3dec3f84f5513688~1';
+# 3e0e596105198cfa (wwwlisting: allow hiding entries from manifest, 2019-06-09)
+$oldrev = xqx([qw(git rev-parse), $oldrev], undef, { 2 => \$err });
# using plackup to test old PublicInbox::WWW since -httpd from
# back then relied on some packages we no longer depend on
my $plackup = which('plackup') or skip('no plackup in path', 1);
require PublicInbox::Lock;
# using plackup to test old PublicInbox::WWW since -httpd from
# back then relied on some packages we no longer depend on
my $plackup = which('plackup') or skip('no plackup in path', 1);
require PublicInbox::Lock;
my $lk = bless { lock_path => __FILE__ }, 'PublicInbox::Lock';
$lk->lock_acquire;
my $psgi = "$wt/app.psgi";
if (!-f $psgi) { # checkout a pre-manifest.js.gz version
my $t = File::Temp->new(TEMPLATE => 'g-XXXX', TMPDIR => 1);
my $env = { GIT_INDEX_FILE => $t->filename };
my $lk = bless { lock_path => __FILE__ }, 'PublicInbox::Lock';
$lk->lock_acquire;
my $psgi = "$wt/app.psgi";
if (!-f $psgi) { # checkout a pre-manifest.js.gz version
my $t = File::Temp->new(TEMPLATE => 'g-XXXX', TMPDIR => 1);
my $env = { GIT_INDEX_FILE => $t->filename };
xsys([qw(git checkout-index -a), "--prefix=$wt/"], $env)
and xbail 'checkout-index';
my $f = "$wt/app.psgi.tmp.$$";
xsys([qw(git checkout-index -a), "--prefix=$wt/"], $env)
and xbail 'checkout-index';
my $f = "$wt/app.psgi.tmp.$$";
$td->join('TERM');
open $rdr->{2}, '>>', "$tmpdir/plackup.err.log" or xbail "open: $!";
open $rdr->{1}, '>>&', $rdr->{2} or xbail "open: $!";
$td->join('TERM');
open $rdr->{2}, '>>', "$tmpdir/plackup.err.log" or xbail "open: $!";
open $rdr->{1}, '>>&', $rdr->{2} or xbail "open: $!";
- $td = start_script($cmd, { PERL5LIB => 'lib' }, $rdr);
+ my $env = { PERL5LIB => 'lib', PERL_INLINE_DIRECTORY => undef };
+ $td = start_script($cmd, $env, $rdr);
# wait for plackup socket()+bind()+listen()
my %opt = ( Proto => 'tcp', Type => Socket::SOCK_STREAM(),
PeerAddr => "$host:$port" );
# wait for plackup socket()+bind()+listen()
my %opt = ( Proto => 'tcp', Type => Socket::SOCK_STREAM(),
PeerAddr => "$host:$port" );
}
my $dst = "$tmpdir/scrape";
@cmd = (qw(-clone -q), "http://$host:$port/v2", $dst);
}
my $dst = "$tmpdir/scrape";
@cmd = (qw(-clone -q), "http://$host:$port/v2", $dst);
is($?, 0, 'scraping clone on old PublicInbox::WWW')
or diag $err;
my @g_all = glob("$dst/git/*.git");
is($?, 0, 'scraping clone on old PublicInbox::WWW')
or diag $err;
my @g_all = glob("$dst/git/*.git");
@cmd = (qw(-clone -q --epoch=~0), "http://$host:$port/v2", $dst);
run_script(\@cmd, undef, { 2 => \($err = '') });
is($?, 0, 'partial scraping clone on old PublicInbox::WWW');
@cmd = (qw(-clone -q --epoch=~0), "http://$host:$port/v2", $dst);
run_script(\@cmd, undef, { 2 => \($err = '') });
is($?, 0, 'partial scraping clone on old PublicInbox::WWW');
is_deeply(\@g_last, [ $g_all[-1] ], 'partial clone of ~0 worked');
chmod(0755, $g_all[0]) or xbail "chmod $!";
is_deeply(\@g_last, [ $g_all[-1] ], 'partial clone of ~0 worked');
chmod(0755, $g_all[0]) or xbail "chmod $!";