summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2019-12-26 19:57:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-01-15 22:02:32 (GMT)
commita7fbf12f2f31cb5aefb4fe7f467564be32c62968 (patch)
tree412eaa3d88773a3d2d217c895fb3198fceb6d11a
parentc7973f249ebe86f10ec4b420a8ab83b8b83bce22 (diff)
downloadgit-a7fbf12f2f31cb5aefb4fe7f467564be32c62968.zip
git-a7fbf12f2f31cb5aefb4fe7f467564be32c62968.tar.gz
git-a7fbf12f2f31cb5aefb4fe7f467564be32c62968.tar.bz2
t/check-non-portable-shell: detect "FOO= shell_func", too
Just like assigning a nonempty value, assigning an empty value to a shell variable when calling a function produces non-portable behavior: in some shells, the assignment lasts for the duration of the function invocation, and in others, it persists after the function returns. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/check-non-portable-shell.pl2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl
index 38bfeeb..fd33035 100755
--- a/t/check-non-portable-shell.pl
+++ b/t/check-non-portable-shell.pl
@@ -46,7 +46,7 @@ while (<>) {
/(?:\$\(seq|^\s*seq\b)/ and err 'seq is not portable (use test_seq)';
/\bgrep\b.*--file\b/ and err 'grep --file FILE is not portable (use grep -f FILE)';
/\bexport\s+[A-Za-z0-9_]*=/ and err '"export FOO=bar" is not portable (use FOO=bar && export FOO)';
- /^\s*([A-Z0-9_]+=(\w+|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and
+ /^\s*([A-Z0-9_]+=(\w*|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and
err '"FOO=bar shell_func" assignment extends beyond "shell_func"';
$line = '';
# this resets our $. for each file