test-lint: find unportable sed, echo, test, and export usage after &&
commit561b46c5c8a9d204974e6edd4f58a5fca343d6d3
authorJonathan Nieder <jrnieder@gmail.com>
Fri, 23 May 2014 18:44:05 +0000 (23 11:44 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 23 May 2014 19:17:38 +0000 (23 12:17 -0700)
treefc87d6837ad6cc47e7ae6c24868aec05beab76ea
parent7bbc4e8fdb33e0a8e42e77cc05460d4c4f615f4d
test-lint: find unportable sed, echo, test, and export usage after &&

Instead of anchoring these checks with "^\s*", just check that the
usage is preceded by a word boundary.  So now we can catch

test $cond && export foo=bar

just like we already catch

test $cond &&
export foo=bar

As a side effect, this will detect usage of "sed -i", "echo -n", "test
a == b", and "export a=b" in comments.  That is not ideal but it's
potentially useful because people sometimes copy code from comments so
it can be good to also avoid nonportable patterns there.

To avoid false positives, keep the checks for 'declare' and 'which'
anchored.  Those are frequently used words in normal English-language
comments.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/check-non-portable-shell.pl