about summary refs log tree commit homepage
path: root/t/index-git-times.t
diff options
context:
space:
mode:
Diffstat (limited to 't/index-git-times.t')
-rw-r--r--t/index-git-times.t33
1 files changed, 17 insertions, 16 deletions
diff --git a/t/index-git-times.t b/t/index-git-times.t
index f9869cfa..eac2d650 100644
--- a/t/index-git-times.t
+++ b/t/index-git-times.t
@@ -1,43 +1,44 @@
 #!perl -w
-# Copyright (C) 2020 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use v5.10.1;
-use Test::More;
 use PublicInbox::TestCommon;
-use PublicInbox::Import;
 use PublicInbox::Config;
 use PublicInbox::Admin;
+use PublicInbox::Import;
 use File::Path qw(remove_tree);
+require PublicInbox::InboxWritable;
 
-require_mods(qw(DBD::SQLite Search::Xapian));
+require_mods(qw(DBD::SQLite Xapian));
 use_ok 'PublicInbox::Over';
 
 my ($tmpdir, $for_destroy) = tmpdir();
 local $ENV{PI_CONFIG} = "$tmpdir/cfg";
 my $v1dir = "$tmpdir/v1";
 my $addr = 'x@example.com';
+my $default_branch = PublicInbox::Import::default_branch;
 run_script(['-init', '--indexlevel=medium', 'v1', $v1dir,
                 'http://example.com/x', $addr])
         or die "init failed";
 
 {
-        my $data = <<'EOF';
+        my $data = <<"EOF";
 blob
 mark :1
 data 133
-From: timeless <t@example.com>
-To: x <x@example.com>
+From: timeless <t\@example.com>
+To: x <x\@example.com>
 Subject: can I haz the time?
-Message-ID: <19700101000000-1234@example.com>
+Message-ID: <19700101000000-1234\@example.com>
 
 plz
 
-reset refs/heads/master
-commit refs/heads/master
+reset $default_branch
+commit $default_branch
 mark :2
-author timeless <t@example.com> 749520000 +0100
-committer x <x@example.com> 1285977600 -0100
+author timeless <t\@example.com> 749520000 +0100
+committer x <x\@example.com> 1285977600 -0100
 data 20
 can I haz the time?
 M 100644 :1 53/256f6177504c2878d3a302ef5090dacf5e752c
@@ -48,7 +49,7 @@ EOF
         print $w $data or die;
         close $w or die;
         my $cmd = ['git', "--git-dir=$v1dir", 'fast-import', '--quiet'];
-        PublicInbox::Import::run_die($cmd, undef, { 0 => $r });
+        xsys_e($cmd, undef, { 0 => $r });
 }
 
 run_script(['-index', '--skip-docdata', $v1dir]) or die 'v1 index failed';
@@ -57,7 +58,7 @@ my $smsg;
 {
         my $cfg = PublicInbox::Config->new;
         my $ibx = $cfg->lookup($addr);
-        my $lvl = PublicInbox::Admin::detect_indexlevel($ibx);
+        my $lvl = PublicInbox::InboxWritable::detect_indexlevel($ibx);
         is($lvl, 'medium', 'indexlevel detected');
         is($ibx->{-skip_docdata}, 1, '--skip-docdata flag set on -index');
         $smsg = $ibx->over->get_art(1);
@@ -73,14 +74,14 @@ my $smsg;
         is($res->[0]->{ds}, $smsg->{ds}, 'Xapian search on datestamp');
 }
 SKIP: {
-        require_git(2.6, 1) or skip('git 2.6+ required for v2', 10);
+        require_git(2.6, 10);
         my $v2dir = "$tmpdir/v2";
         run_script(['-convert', $v1dir, $v2dir]) or die 'v2 conversion failed';
 
         my $check_v2 = sub {
                 my $ibx = PublicInbox::Inbox->new({inboxdir => $v2dir,
                                 address => $addr});
-                my $lvl = PublicInbox::Admin::detect_indexlevel($ibx);
+                my $lvl = PublicInbox::InboxWritable::detect_indexlevel($ibx);
                 is($lvl, 'medium', 'indexlevel detected after convert');
                 is($ibx->{-skip_docdata}, 1,
                         '--skip-docdata preserved after convert');