forked from rerun-io/rerun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpre-push.sh
executable file
·25 lines (20 loc) · 902 Bytes
/
pre-push.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
# This script is intended to be called from the git pre-push hook.
# See: hooks/README.md for more details.
# Check if pixi is installed
if ! command -v "pixi" > /dev/null 2>&1; then
echo "The rerun hooks require 'pixi', which is not installed or not in your PATH. Please run: 'cargo install pixi'."
exit 1
fi
while read local_ref local_sha remote_ref remote_sha; do
# Extract the branch name from the local reference
branch_name=$(echo "$local_ref" | sed 's/^refs\/heads\///')
# Get the name of the currently active branch
active_branch=$(git symbolic-ref --short HEAD)
# Check if the pushed branch matches the active branch
if [ "$branch_name" = "$active_branch" ]; then
exec pixi run fast-lint $@
else
echo "Skipping fast-lint because the pushed branch ($branch_name) does not match the active branch ($active_branch)."
fi
done