From 38678a15a2bf65580573a46e967c1d8d269965ae Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Mon, 8 Jul 2013 17:20:31 +0200 Subject: t9902: fix 'test A == B' to use = operator The == operator as an alias to = is not POSIX. This doesn't actually matter for the execution of the script, because it only runs when the shell is bash. However, it trips up test-lint, so it's nicer to use the standard form. Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 6d9d141..a71d8b4 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -69,7 +69,7 @@ run_completion () local -a COMPREPLY _words local _cword _words=( $1 ) - test "${1: -1}" == ' ' && _words+=('') + test "${1: -1}" = ' ' && _words+=('') (( _cword = ${#_words[@]} - 1 )) __git_wrap__git_main && print_comp } -- cgit v0.10.2-6-g49f6 From 9968ffff0d09b4925f339cceafb5f7e7cd78fb02 Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Mon, 8 Jul 2013 17:20:32 +0200 Subject: test-lint: detect 'export FOO=bar' 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 Signed-off-by: Junio C Hamano diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl index 8b5a71d..45971f4 100755 --- a/t/check-non-portable-shell.pl +++ b/t/check-non-portable-shell.pl @@ -21,6 +21,7 @@ while (<>) { /^\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; } -- cgit v0.10.2-6-g49f6