about summary refs log tree commit homepage
path: root/t/git.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-11-04 03:01:33 +0000
committerEric Wong <e@80x24.org>2019-11-08 20:21:45 +0000
commitb8076445430956bd87ade6345e6c01109a485bf7 (patch)
tree6c198f76aab82dc25eb57d1fcf146f9e60fa03b7 /t/git.t
parent118ec03fd467173c401518becd54b621f9abb080 (diff)
downloadpublic-inbox-b8076445430956bd87ade6345e6c01109a485bf7.tar.gz
One small step towards making tests easier-to-run.  We can rely
on "local $ENV{GIT_DIR}" for potentially shell-unsafe path
names, and the rest of our path names are relative and don't
contain characters which require escaping.
Diffstat (limited to 't/git.t')
-rw-r--r--t/git.t12
1 files changed, 6 insertions, 6 deletions
diff --git a/t/git.t b/t/git.t
index 445ef248..a496f851 100644
--- a/t/git.t
+++ b/t/git.t
@@ -7,16 +7,14 @@ use File::Temp qw/tempdir/;
 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');
 }
 
@@ -46,8 +44,10 @@ if (1) {
         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;