Skip to content

Commit

Permalink
indentation test: improve interpretation of commit ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Dec 25, 2015
1 parent 4b72357 commit 8949c44
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions ci/travis/linux/before_install.sh
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ sudo apt-get install --force-yes --no-install-recommends --no-install-suggests \
xvfb \ xvfb \
python-pip \ python-pip \
flip \ flip \
jq \
postgresql-9.1-postgis-2.1/precise # from ubuntugis-unstable, not pgdg postgresql-9.1-postgis-2.1/precise # from ubuntugis-unstable, not pgdg


sudo -H pip install autopep8 # TODO when switching to trusty or above: replace python-pip with python-autopep8 sudo -H pip install autopep8 # TODO when switching to trusty or above: replace python-pip with python-autopep8
Expand Down
19 changes: 11 additions & 8 deletions scripts/verify-indentation.sh
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ if [ -z "$TRAVIS_COMMIT_RANGE" ]; then
exit 0 exit 0
fi fi


TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE/.../..}

if ! type -p astyle.sh >/dev/null; then if ! type -p astyle.sh >/dev/null; then
echo astyle.sh not found echo astyle.sh not found
exit 1 exit 1
Expand All @@ -21,12 +19,17 @@ set -e
ASTYLEDIFF=/tmp/astyle.diff ASTYLEDIFF=/tmp/astyle.diff
>$ASTYLEDIFF >$ASTYLEDIFF


echo "Checking indentation in $TRAVIS_COMMIT_RANGE" case "${TRAVIS_COMMIT_RANGE}" in
echo "Checking indentation in $TRAVIS_COMMIT_RANGE" >>/tmp/ctest-important.log *...*)
git log $TRAVIS_COMMIT_RANGE >>/tmp/ctest-important.log 2>&1 curl https://api.github.com/repos/$TRAVIS_REPO_SLUG/compare/$TRAVIS_COMMIT_RANGE | jq -r .files[].filename >/tmp/changed-files
git diff --name-only $TRAVIS_COMMIT_RANGE >>/tmp/ctest-important.log 2>&1 ;;

*)
git diff --name-only $TRAVIS_COMMIT_RANGE >/tmp/changed-files
;;
esac


git diff --name-only $TRAVIS_COMMIT_RANGE | while read f while read f
do do
if ! [ -f "$f" ]; then if ! [ -f "$f" ]; then
echo "$f was removed." >>/tmp/ctest-important.log echo "$f was removed." >>/tmp/ctest-important.log
Expand Down Expand Up @@ -56,7 +59,7 @@ do
else else
echo "File $f needs indentation" echo "File $f needs indentation"
fi fi
done done </tmp/changed-files


if [ -s "$ASTYLEDIFF" ]; then if [ -s "$ASTYLEDIFF" ]; then
echo echo
Expand Down

0 comments on commit 8949c44

Please sign in to comment.