various improvements
[distro-setup] / .git_template / hooks / pre-commit
index 182dcb9af9ea5fcac76786e4bf293c677afbd5ed..33a6f8ca3280a918b2e91175818d507771790607 100755 (executable)
@@ -94,8 +94,9 @@ if ! git rev-list HEAD --count &>/dev/null; then
     cat <<'EOF'
 Whitespace issues found. We can't fix in a pre-commit hook for the first commit.
 Either fix on your own. I suggest https://github.com/dlenski/wtf, from git root:
-find . -not -name .git -type f -exec bash -c \
-         'grep -Il "" "$1" &>/dev/null && wtf.py -i -E lf "$1"' _ {} \;
+
+git ls-files --exclude-standard -cmo --no-empty-directory | while read -r f; do if [[ -L $f ]] || ! grep -Iq . "$f"; then continue; fi;  wtf.py -i -E lf "$f"; done
+
 or allow whitespace with:
 git config hooks.allowwhitespace true, or export GIT_ALLOWWHITESPACE=true
 EOF