add script to replace tabs by spaces and removing trailing whitespaces

This commit is contained in:
Sébastien Loriot 2019-05-19 17:52:06 +02:00
parent 2419170514
commit da0f21e667
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
#!/bin/bash
if ! git diff --exit-code > /dev/null || ! git diff --staged --exit-code > /dev/null ; then
echo 'Your working directory contains local modifications!' >&2
exit 1
fi
if [ ! -f Installation/include/CGAL/version.h ]; then
echo "This script should be run at the root of a CGAL branch" >&2
exit 1
fi
# replace tabs by two spaces in AABB-tree and Minkowski_sum_2 packages
find AABB_tree -name '*.h' -o -name '*.cpp' -o -name '*.txt' | xargs sed -i -E 's/\t/ /g'
find Minkowski_sum_2 -name '*.h' -o -name '*.cpp' -o -name '*.txt' | xargs sed -i -E 's/\t/ /g'
#replace tabs by 8 spaces for all other packages
find . -name '*.h' -o -name '*.cpp' -o -name '*.hpp' -o -name '*.tcc' -o -name '*.txt' | xargs sed -i -E 's/\t/ /g'
#remove trailing whitespace
find . -name '*.h' -o -name '*.cpp' -o -name '*.hpp' -o -name '*.tcc' -o -name '*.txt' | xargs sed -i -E 's/\s+$//'