summary refs log tree commit diff
path: root/src/etc/pre-push.sh
blob: 6f86c7ab8a448e56d251c34aa48b39a4489a7dca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env bash
#
# Call `tidy` before git push
# Copy this script to .git/hooks to activate,
# and remove it from .git/hooks to deactivate.
#

set -Euo pipefail

ROOT_DIR="$(git rev-parse --show-toplevel)"

echo "Running pre-push script $ROOT_DIR/x test tidy"

cd "$ROOT_DIR"
./x test tidy --set build.locked-deps=true
if [ $? -ne 0 ]; then
    echo "You may use \`git push --no-verify\` to skip this check."
    exit 1
fi