Permalink
Show file tree
Hide file tree
1 comment
on commit
sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
cat '/tmp/ctest-important.log' | ||
[ -r /tmp/ctest-important.log ] && cat /tmp/ctest-important.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/bash | ||
|
||
cd $(git rev-parse --show-toplevel) | ||
|
||
export PATH=$PATH:$PWD/scripts | ||
|
||
if [ -z "$TRAVIS_COMMIT_RANGE" ]; then | ||
echo "No commit range given" | ||
exit 0 | ||
fi | ||
|
||
TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE/.../..} | ||
|
||
if ! type -p astyle.sh >/dev/null; then | ||
echo astyle.sh not found | ||
exit 1 | ||
fi | ||
|
||
set -e | ||
|
||
ASTYLEDIFF=/tmp/astyle.diff | ||
>$ASTYLEDIFF | ||
|
||
echo "Checking indentation in $TRAVIS_COMMIT_RANGE" | ||
echo "Checking indentation in $TRAVIS_COMMIT_RANGE" >>/tmp/ctest-important.log | ||
git log $TRAVIS_COMMIT_RANGE >>/tmp/ctest-important.log 2>&1 | ||
git diff --name-only $TRAVIS_COMMIT_RANGE >>/tmp/ctest-important.log 2>&1 | ||
|
||
git diff --name-only $TRAVIS_COMMIT_RANGE | while read f | ||
do | ||
echo "Checking $f" >>/tmp/ctest-important.log | ||
case "$f" in | ||
src/core/gps/qextserialport/*|src/plugins/dxf2shp_converter/dxflib/src/*|src/plugins/globe/osgEarthQt/*|src/plugins/globe/osgEarthUtil/*) | ||
echo $f skipped | ||
continue | ||
;; | ||
|
||
*.cpp|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H|*.sip|*.py) | ||
;; | ||
|
||
*) | ||
continue | ||
;; | ||
esac | ||
|
||
m=$f.prepare | ||
cp "$f" "$m" | ||
astyle.sh "$f" | ||
if diff -u "$m" "$f" >>$ASTYLEDIFF; then | ||
rm $m | ||
else | ||
echo "File $f needs indentation" | ||
fi | ||
done | ||
|
||
if [ -s "$ASTYLEDIFF" ]; then | ||
echo | ||
echo "Required indentation updates:" | ||
cat "$ASTYLEDIFF" | ||
|
||
cat <<EOF | ||
Tips to prevent and resolve: | ||
* Enable WITH_ASTYLE in your cmake configuration | ||
* Use scripts/astyle.sh file to fix the now badly indented files | ||
* Consider using scripts/prepare-commit.sh as pre-commit hook to avoid this | ||
in the future (ln -s scripts/prepare-commit.sh .git/hooks/pre-commit) or | ||
run it manually before each commit. | ||
EOF | ||
|
||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0d5d3bc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice