about summary refs log tree commit homepage
path: root/t/mda.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-04-25 09:50:02 +0000
committerEric Wong <e@80x24.org>2016-04-25 09:50:35 +0000
commit24e0219f364ed402f9136227756e0f196dc651aa (patch)
tree6c96cc67c6871ffb7e72c89ea41c80fe02e87a54 /t/mda.t
parentfe3d2447badd595df784541556311137b920b0a2 (diff)
downloadpublic-inbox-24e0219f364ed402f9136227756e0f196dc651aa.tar.gz
No need to maintain per-block environment state when we can
localize it to per-command.  We've had --git-dir= in git
since 1.4.2 (2006-08-12) and already use it all over the
place.
Diffstat (limited to 't/mda.t')
-rw-r--r--t/mda.t11
1 files changed, 4 insertions, 7 deletions
diff --git a/t/mda.t b/t/mda.t
index 6b7527d4..ad6a0913 100644
--- a/t/mda.t
+++ b/t/mda.t
@@ -92,11 +92,10 @@ EOF
         {
                 local $ENV{PATH} = $main_path;
                 run([$mda], \$in);
-                local $ENV{GIT_DIR} = $maindir;
-                my $rev = `git rev-list HEAD`;
+                my $rev = `git --git-dir=$maindir rev-list HEAD`;
                 like($rev, qr/\A[a-f0-9]{40}/, "good revision committed");
                 chomp $rev;
-                my $cmt = `git cat-file commit $rev`;
+                my $cmt = `git --git-dir=$maindir cat-file commit $rev`;
                 like($cmt, qr/^author Me <me\@example\.com> 0 \+0000\n/m,
                         "author info set correctly");
                 like($cmt, qr/^committer test <test-public\@example\.com>/m,
@@ -109,8 +108,7 @@ EOF
                 ok(!-e $failbox, "nothing in PI_EMERGENCY before");
                 local $ENV{PATH} = $fail_path;
                 run([$mda], \$in);
-                local $ENV{GIT_DIR} = $maindir;
-                my @revs = `git rev-list HEAD`;
+                my @revs = `git --git-dir=$maindir rev-list HEAD`;
                 is(scalar @revs, 1, "bad revision not committed");
                 ok(-s $failbox > 0, "PI_EMERGENCY is written to");
         }
@@ -330,8 +328,7 @@ sub fail_bad_header {
         my ($out, $err) = ("", "");
         local $ENV{PATH} = $main_path;
         run([$mda], \$in, \$out, \$err);
-        local $ENV{GIT_DIR} = $maindir;
-        my $rev = `git rev-list HEAD`;
+        my $rev = `git --git-dir=$maindir rev-list HEAD`;
         chomp $rev;
         is($rev, $good_rev, "bad revision not commited ($msg)");
         ok(-s $failbox > 0, "PI_EMERGENCY is written to ($msg)");