Update Makefile and check_whitespace.sh.

This commit is contained in:
Markus F.X.J. Oberhumer
2016-10-03 13:13:13 +02:00
parent 06eb244800
commit 42d49e9d50
6 changed files with 32 additions and 27 deletions
+3 -2
View File
@@ -15,9 +15,10 @@ find . \
-type f -iname '*.exe' -prune -o \
-type f -iname '*.pdf' -prune -o \
-type f -iname '*.swp' -prune -o \
-type f -print0 | LC_ALL=C sort -z | \
xargs -0r perl -n -e '
-type f -print0 | \
LC_ALL=C sort -z | xargs -0r perl -n -e '
#print("$ARGV\n");
if (m,[\x00\x01\x02\xfe\xff],) { print "ERROR: binary file detected $ARGV: $_"; exit(1); }
if (m,[\r\x1a],) { print "ERROR: DOS EOL detected $ARGV: $_"; exit(1); }
if (m,([ \t]+)$,) {
# allow exactly two trailing spaces for GitHub flavoured Markdown in .md files
+8 -5
View File
@@ -7,12 +7,15 @@ set -e; set -o pipefail
[[ -z $1 ]] || cd "$1" || exit 1
[[ -d .git ]] || exit 1
# info: cannot use "-z" as that needs GNU sed 4.2.2 which is not installed on Ubuntu 12.04
git ls-files --full-name | sed 's/^/\.\//' |\
sed -e '/lzma-sdk$/d' -e '/\.exe$/d' |\
LC_ALL=C sort | \
xargs -r perl -n -e '
git ls-files --full-name -z | perl -0 -n -e '
s,^,./,;
if (m,^\./src/lzma-sdk(\0|$),) { }
elsif (m,\.bat(\0|$),) { }
elsif (m,\.exe(\0|$),) { }
else { print; }
' | LC_ALL=C sort -z | xargs -0r perl -n -e '
#print("$ARGV\n");
if (m,[\x00\x01\x02\xfe\xff],) { print "ERROR: binary file detected $ARGV: $_"; exit(1); }
if (m,[\r\x1a],) { print "ERROR: DOS EOL detected $ARGV: $_"; exit(1); }
if (m,([ \t]+)$,) {
# allow exactly two trailing spaces for GitHub flavoured Markdown in .md files