mirror of https://github.com/zulip/zulip.git
tools: Don't lint in pre-commit hook if no files changed.
This commit is contained in:
parent
5ada385b91
commit
ac488fd45f
|
@ -9,11 +9,17 @@
|
||||||
# contains your provisioned Zulip development environment, the linter
|
# contains your provisioned Zulip development environment, the linter
|
||||||
# will automatically be run through `vagrant ssh`.
|
# will automatically be run through `vagrant ssh`.
|
||||||
|
|
||||||
|
changed_files=$(git diff --cached --name-only --diff-filter=ACM)
|
||||||
|
if [ -z "$changed_files" ]; then
|
||||||
|
echo "No changed files to lint."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$VIRTUAL_ENV" ] && `which vagrant > /dev/null` && [ -e .vagrant ]; then
|
if [ -z "$VIRTUAL_ENV" ] && `which vagrant > /dev/null` && [ -e .vagrant ]; then
|
||||||
vcmd='/srv/zulip/tools/lint-all --pep8 --force $(cd /srv/zulip && git diff --cached --name-only --diff-filter=ACM) || true'
|
vcmd="/srv/zulip/tools/lint-all --pep8 --force $changed_files || true"
|
||||||
echo "Running lint-all using vagrant..."
|
echo "Running lint-all using vagrant..."
|
||||||
vagrant ssh -c "$vcmd"
|
vagrant ssh -c "$vcmd"
|
||||||
else
|
else
|
||||||
./tools/lint-all --pep8 --force $(git diff --cached --name-only --diff-filter=ACM) || true
|
./tools/lint-all --pep8 --force $changed_files || true
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue