Skip to content

Commit 8949c44

Browse files
committedDec 25, 2015
indentation test: improve interpretation of commit ranges
1 parent 4b72357 commit 8949c44

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed
 

‎ci/travis/linux/before_install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ sudo apt-get install --force-yes --no-install-recommends --no-install-suggests \
6161
xvfb \
6262
python-pip \
6363
flip \
64+
jq \
6465
postgresql-9.1-postgis-2.1/precise # from ubuntugis-unstable, not pgdg
6566

6667
sudo -H pip install autopep8 # TODO when switching to trusty or above: replace python-pip with python-autopep8

‎scripts/verify-indentation.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ if [ -z "$TRAVIS_COMMIT_RANGE" ]; then
99
exit 0
1010
fi
1111

12-
TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE/.../..}
13-
1412
if ! type -p astyle.sh >/dev/null; then
1513
echo astyle.sh not found
1614
exit 1
@@ -21,12 +19,17 @@ set -e
2119
ASTYLEDIFF=/tmp/astyle.diff
2220
>$ASTYLEDIFF
2321

24-
echo "Checking indentation in $TRAVIS_COMMIT_RANGE"
25-
echo "Checking indentation in $TRAVIS_COMMIT_RANGE" >>/tmp/ctest-important.log
26-
git log $TRAVIS_COMMIT_RANGE >>/tmp/ctest-important.log 2>&1
27-
git diff --name-only $TRAVIS_COMMIT_RANGE >>/tmp/ctest-important.log 2>&1
22+
case "${TRAVIS_COMMIT_RANGE}" in
23+
*...*)
24+
curl https://api.github.com/repos/$TRAVIS_REPO_SLUG/compare/$TRAVIS_COMMIT_RANGE | jq -r .files[].filename >/tmp/changed-files
25+
;;
26+
27+
*)
28+
git diff --name-only $TRAVIS_COMMIT_RANGE >/tmp/changed-files
29+
;;
30+
esac
2831

29-
git diff --name-only $TRAVIS_COMMIT_RANGE | while read f
32+
while read f
3033
do
3134
if ! [ -f "$f" ]; then
3235
echo "$f was removed." >>/tmp/ctest-important.log
@@ -56,7 +59,7 @@ do
5659
else
5760
echo "File $f needs indentation"
5861
fi
59-
done
62+
done </tmp/changed-files
6063

6164
if [ -s "$ASTYLEDIFF" ]; then
6265
echo

0 commit comments

Comments
 (0)
Please sign in to comment.