• Jonathan Nieder's avatar
    test-lint: find unportable sed, echo, test, and export usage after && · 561b46c5
    Jonathan Nieder authored
    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: default avatarJonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    561b46c5
check-non-portable-shell.pl 800 Bytes