From 0e933ed9b8a751d70623f72fbee98ad77af7578c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 28 Dec 2018 10:16:11 +0000 Subject: init: allow --skip of old epochs for -V2 repos This allows archivists to publish incomplete archives with newer mail while allowing "0.git" (or "1.git" and so on) epochs to be added-after-the-fact (without affecting "git clone" followers). A reindex will be necessary for Xapian and SQLite to catch up once the old epochs are added; but the reindexing code is also capable of tolerating missing epochs. --- t/init.t | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 't') diff --git a/t/init.t b/t/init.t index 182d065c..1551a304 100644 --- a/t/init.t +++ b/t/init.t @@ -79,6 +79,22 @@ SKIP: { is(system(@cmd), 0, "-init -L $lvl"); is(read_indexlevel("v2$lvl"), $lvl, "indexlevel set to '$lvl'"); } + + # loop for idempotency + for (1..2) { + @cmd = (pi_init, '-V2', '-S1', 'skip1', "$tmpdir/skip1", + qw(http://example.com/skip1 skip1@example.com)); + is(system(@cmd), 0, "--skip 1"); + my $gits = [ glob("$tmpdir/skip1/git/*.git") ]; + is_deeply(["$tmpdir/skip1/git/1.git"], $gits, 'skip OK'); + } + + + @cmd = (pi_init, '-V2', '--skip=2', 'skip2', "$tmpdir/skip2", + qw(http://example.com/skip2 skip2@example.com)); + is(system(@cmd), 0, "--skip 2"); + my $gits = [ glob("$tmpdir/skip2/git/*.git") ]; + is_deeply(["$tmpdir/skip2/git/2.git"], $gits, 'skipping 2 works, too'); } done_testing(); -- cgit v1.2.3-24-ge0c7