test-lint: detect 'export FOO=bar'
authorThomas Rast <trast@inf.ethz.ch>
Mon, 8 Jul 2013 15:20:32 +0000 (17:20 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 8 Jul 2013 17:21:33 +0000 (10:21 -0700)
Some shells do not understand the one-line construct, and instead need

FOO=bar &&
export FOO

Detect this in the test-lint target.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/check-non-portable-shell.pl
index 8b5a71dc05216dc0acfb7761a4b9ca789c716ce0..45971f43b77142fe1bb90262974c83c786cfe43d 100755 (executable)
@@ -21,6 +21,7 @@ sub err {
        /^\s*declare\s+/ and err 'arrays/declare not portable';
        /^\s*[^#]\s*which\s/ and err 'which is not portable (please use type)';
        /test\s+[^=]*==/ and err '"test a == b" is not portable (please use =)';
+       /^\s*export\s+[^=]*=/ and err '"export FOO=bar" is not portable (please use FOO=bar && export FOO)';
        # this resets our $. for each file
        close ARGV if eof;
 }