[PATCH v2 4/8] tests: add a check for unportable env --unset
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Dec 13, 2018, 15:58 UTC
- Message-ID
- <20181213155817.27666-5-avarab@gmail.com>
- In-Reply-To
- <xmqqimzygmz6.fsf@gitster-ct.c.googlers.com>
The "env --unset=*" argument isn't portable. Neither Solaris or AIX have it, and probably not a bunch of other POSIX-like OS's.
Using this was suggested on-list[1]. Let's add a check for it so it doesn't sneak into the codebase in the future.
1. https://public-inbox.org/git/cover.1544573604.git.jonathantanmy@google.com/
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- t/check-non-portable-shell.pl | 1 + 1 file changed, 1 insertion(+)
diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl index b45bdac688..1cfb4608ee 100755 --- a/t/check-non-portable-shell.pl +++ b/t/check-non-portable-shell.pl @@ -35,6 +35,7 @@ sub err { chomp; } + /\benv (?:-u|--unset)\b/ and err 'env [-u|--unset] is not portable'; /\bsed\s+-i/ and err 'sed -i is not portable'; /\becho\s+-[neE]/ and err 'echo with option is not portable (use printf)'; /^\s*declare\s+/ and err 'arrays/declare not portable';
-- 2.20.0.405.gbc1bbc6f85