Skip to content

Commit

Permalink
Make pre-push script more robust.
Browse files Browse the repository at this point in the history
  • Loading branch information
axel22 committed Apr 28, 2019
1 parent 5be1872 commit e38460b
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions tools/pre-push
@@ -1,21 +1,26 @@
#!/bin/sh
#!/bin/bash

EXIT_CODE=0

# Hooks are always executed from .git/hooks
HOOKS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
TOOLS_DIR="${HOOKS_DIR}/../../tools"
ROOT_DIR="$(git rev-parse --show-toplevel)"
TOOLS_DIR="${ROOT_DIR}/tools"

echo ":: Running pre-push format check ::"
"$TOOLS_DIR"/sbt/bin/sbt 'renaissanceFormatCheck'
FORMAT_CHECK=$?

if [[ FORMAT_CHECK -ne 0 ]]; then
>&2 echo "Code format check failed !"
EXIT_CODE=1
>&2 echo "Code format check failed!"
EXIT_CODE=1
else
echo "Format check passed."
fi

if [[ EXIT_CODE -ne 0 ]]; then
>&2 echo "Push aborted."
>&2 echo "Push aborted."
exit $EXIT_CODE
fi

echo ""
echo "Pre-push checks successful."
exit $EXIT_CODE

0 comments on commit e38460b

Please sign in to comment.