ray/ci/travis/check-git-clang-format-output.sh
Mitchell Stern 1531c21dbd [Dashboard] Add remaining features from old dashboard (#6489)
* [Dashboard] Add remaining features from old dashboard

* Fix linting errors

* Set cluster uptime statistic to N/A

* Use proper singular or plural words for workers column

* Ignore .js, .jsx, .ts, .tsx files in check-git-clang-format-output.sh

* Fix bash quote issue
2019-12-16 11:21:18 -08:00

20 lines
770 B
Bash
Executable file

#!/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
exclude_regex="(.*thirdparty/|.*redismodule.h|.*.java|.*.jsx?|.*.tsx?)"
output=$(ci/travis/git-clang-format --binary clang-format --commit $base_commit --diff --exclude "$exclude_regex")
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"
exit 1
fi