about summary refs log tree commit homepage
path: root/public-inbox.cgi
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-04-29 05:33:45 +0000
committerEric Wong <e@80x24.org>2014-04-29 05:33:45 +0000
commitd47ac116dde198c610fdb6e03c48e9980071aa3d (patch)
tree37a9581c79f7ef3fa32d1625730cb2044c132815 /public-inbox.cgi
parent0f03ff48b643a3b04bc44d2e1af27bd7dafd56c1 (diff)
downloadpublic-inbox-d47ac116dde198c610fdb6e03c48e9980071aa3d.tar.gz
ENV changes do not propagate to child processes under mod_perl
Diffstat (limited to 'public-inbox.cgi')
-rwxr-xr-xpublic-inbox.cgi8
1 files changed, 6 insertions, 2 deletions
diff --git a/public-inbox.cgi b/public-inbox.cgi
index ffd6ec08..6f20e145 100755
--- a/public-inbox.cgi
+++ b/public-inbox.cgi
@@ -142,12 +142,16 @@ sub get_index {
 # just returns a string ref for the blob in the current ctx
 sub mid2blob {
         my ($ctx) = @_;
-        local $ENV{GIT_DIR} = $ctx->{git_dir};
         require Digest::SHA;
         my $hex = Digest::SHA::sha1_hex($ctx->{mid});
         $hex =~ /\A([a-f0-9]{2})([a-f0-9]{38})\z/i or
                         die "BUG: not a SHA-1 hex: $hex";
-        my $blob = `git cat-file blob HEAD:$1/$2 2>/dev/null`;
+        require IPC::Run;
+        my ($in, $blob, $err);
+        open my $null, '+<', '/dev/null' or die "open: $!\n";
+        IPC::Run::run(['git', '--git-dir', $ctx->{git_dir},
+                        qw(cat-file blob), "HEAD:$1/$2"],
+                        $null, \$blob, $null);
         $? == 0 ? \$blob : undef;
 }