tests: add lint for non portable cp -a
authorCarlo Marcelo Arenas Belón <carenas@gmail.com>
Sat, 1 Dec 2018 17:36:45 +0000 (09:36 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Dec 2018 00:26:02 +0000 (09:26 +0900)
cp -a, while a common flag isn't in POSIX and will therefore fail
on systems that don't have GNUish tools (like OpenBSD, AIX or Solaris)

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/check-non-portable-shell.pl
index b45bdac688c40104dd42ef68a07690420d96c142..8037eef7777b4f65af44b3c8cc3e4b46d48259ae 100755 (executable)
@@ -35,6 +35,7 @@ sub err {
                chomp;
        }
 
+       /\bcp\s+-a/ and err 'cp -a 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';