diff options
author | scnorton <scnorton@biociphers.org> | 2017-06-27 15:01:18 -0400 |
---|---|---|
committer | scnorton <scnorton@biociphers.org> | 2017-06-27 15:01:18 -0400 |
commit | 00c7dee919c8f93b8519a7eede2c41ba2ddcaf08 (patch) | |
tree | 5707f8764920abcd4cffca84c675e5c53c32559d /.travis/check-git-clang-format-output.sh | |
parent | 3d9eb18add0d8a9eb5bfa77fc64cd7b1f37fea5d (diff) | |
parent | 06b6cada0ddedc62063171703ba6607019751a9a (diff) |
Merge branch 'master' into pokemon_data
Diffstat (limited to '.travis/check-git-clang-format-output.sh')
-rwxr-xr-x | .travis/check-git-clang-format-output.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/.travis/check-git-clang-format-output.sh b/.travis/check-git-clang-format-output.sh new file mode 100755 index 000000000..e6acf8ced --- /dev/null +++ b/.travis/check-git-clang-format-output.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +if [ "$TRAVIS_PULL_REQUEST" == "false" ] ; then + # Not in a pull request, so compare against parent commit + base_commit="HEAD^" + echo "Running clang-format against parent commit $(git rev-parse $base_commit)" +else + base_commit="$TRAVIS_BRANCH" + echo "Running clang-format against branch $base_commit, with hash $(git rev-parse $base_commit)" +fi + +output="$(.travis/git-clang-format --binary clang-format-5.0 --commit $base_commit --diff)" + +if [ "$output" == "no modified files to format" ] || [ "$output" == "clang-format did not modify any files" ] ; then + echo "clang-format passed." + exit 0 +else + echo "clang-format failed:" + echo "$output" | colordiff + exit 0 +fi |