From d55abcc42bde846d9047491125dd2b32645dafd8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 19 Apr 2020 23:19:34 +0000 Subject: import: init_bare: allow use as method, use in tests Allowing ->init_bare to be used as a method saves some keystrokes, and we can save a little bit of time on systems with our vfork(2)-enabled spawn(). This also sets us up for future improvements where we can avoid spawning a process at all. --- t/git.t | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 't/git.t') diff --git a/t/git.t b/t/git.t index 8224969d..0936ac5e 100644 --- a/t/git.t +++ b/t/git.t @@ -6,11 +6,12 @@ use Test::More; use PublicInbox::TestCommon; my ($dir, $for_destroy) = tmpdir(); use PublicInbox::Spawn qw(popen_rd); +use PublicInbox::Import; use_ok 'PublicInbox::Git'; { - is(system(qw(git init -q --bare), $dir), 0, 'created git directory'); + PublicInbox::Import::init_bare($dir); my $fi_data = './t/git.fast-import-data'; ok(-r $fi_data, "fast-import data readable (or run test at top level)"); local $ENV{GIT_DIR} = $dir; @@ -90,7 +91,7 @@ if (1) { if ('alternates reloaded') { my ($alt, $alt_obj) = tmpdir(); my @cmd = ('git', "--git-dir=$alt", qw(hash-object -w --stdin)); - is(system(qw(git init -q --bare), $alt), 0, 'create alt directory'); + PublicInbox::Import::init_bare($alt); open my $fh, '<', "$alt/config" or die "open failed: $!\n"; my $rd = popen_rd(\@cmd, {}, { 0 => $fh } ); close $fh or die "close failed: $!"; -- cgit v1.2.3-24-ge0c7