-# Copyright (C) 2015-2018 all contributors <meta@public-inbox.org>
+# Copyright (C) 2015-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
use warnings;
my $dir = tempdir('pi-git-XXXXXX', TMPDIR => 1, CLEANUP => 1);
use PublicInbox::Spawn qw(popen_rd);
-eval { require IPC::Run } or plan skip_all => 'IPC::Run missing';
use_ok 'PublicInbox::Git';
{
is(system(qw(git init -q --bare), $dir), 0, 'created git directory');
- my $cmd = [ 'git', "--git-dir=$dir", 'fast-import', '--quiet' ];
-
my $fi_data = './t/git.fast-import-data';
ok(-r $fi_data, "fast-import data readable (or run test at top level)");
- IPC::Run::run($cmd, '<', $fi_data);
+ local $ENV{GIT_DIR} = $dir;
+ system("git fast-import --quiet <$fi_data");
is($?, 0, 'fast-import succeeded');
}
my $size = -s $big_data;
ok($size > 8192, 'file is big enough');
- my $buf = '';
- IPC::Run::run($cmd, '<', $big_data, '>', \$buf);
+ my $buf = do {
+ local $ENV{GIT_DIR} = $dir;
+ `git hash-object -w --stdin <$big_data`;
+ };
is(0, $?, 'hashed object successfully');
chomp $buf;