]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/cgi.t
remove GIT_DIR env usage in favor of --git-dir
[public-inbox.git] / t / cgi.t
diff --git a/t/cgi.t b/t/cgi.t
index f1a2730c6d799d27bd476d4467f2773d7c6818b4..dcbfb4ce5634e732dd704e44a6c11d9976b844d3 100644 (file)
--- a/t/cgi.t
+++ b/t/cgi.t
@@ -62,8 +62,7 @@ zzzzzz
 EOF
                my $in = $simple->as_string;
                run_with_env({PATH => $main_path}, [$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");
        }
 
@@ -85,8 +84,7 @@ what?
 EOF
                my $in = $reply->as_string;
                run_with_env({PATH => $main_path}, [$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");
        }
 
@@ -169,7 +167,6 @@ EOF
                local $ENV{ORIGINAL_RECIPIENT} = $addr;
                run_with_env({PATH => $main_path}, [$mda], \$in);
        }
-       local $ENV{GIT_DIR} = $maindir;
 
        my $res = cgi_run("/test/slashy%2fasdf%40example.com/raw");
        like($res->{body}, qr/Message-Id: <\Q$slashy_mid\E>/,
@@ -188,9 +185,11 @@ EOF
        like($res->{head}, qr/Status: 300 Multiple Choices/, "mid html miss");
 
        $res = cgi_run("/test/blahblah\@example.com/f/");
-       like($res->{body}, qr/\A<html>/, "mid html");
-       like($res->{head}, qr/Status: 200 OK/, "200 response");
-       $res = cgi_run("/test/blahblah\@example.con/f/");
+       like($res->{head}, qr/Status: 301 Moved/, "301 response");
+       like($res->{head},
+               qr!^Location: http://[^/]+/test/blahblah%40example\.com/\r\n!ms,
+               '301 redirect location');
+       $res = cgi_run("/test/blahblah\@example.con/");
        like($res->{head}, qr/Status: 300 Multiple Choices/, "mid html miss");
 
        $res = cgi_run("/test/");