[Open-scap] Anti whitespace trick

Šimon Lukašík slukasik at redhat.com
Thu Oct 1 12:20:15 UTC 2015


Hello Team,

Here is an easy and non-intrusive way to avoid whitespaces in git commits.

cat > .git/hooks/pre-commit <<__END__
#!/bin/bash
for FILE in `exec git diff-index --check --cached HEAD -- | sed 
'/^[+-]/d' | sed -r 's/:[0-9]+:.*//' | uniq` ; do
    grep '[[:space:]]\+$' $FILE && echo "Trailing Whitespace Detected!: 
$FILE" && sleep 10
done
true
__END__


Being whitespace-sick? Use the trick!

~š.




More information about the Open-scap-list mailing list