Skip to content

Commit

Permalink
Skip tidy in pre-push hook if the user is deleting a remote branch
Browse files Browse the repository at this point in the history
  • Loading branch information
yotamofek committed Feb 25, 2025
1 parent ad27045 commit 41a7c83
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/etc/pre-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@

set -Euo pipefail

# Check if the push is doing anything other than deleting remote branches
SKIP=true
while read LOCAL_REF LOCAL_SHA REMOTE_REF REMOTE_SHA; do
if [[ "$LOCAL_REF" != "(delete)" || \
"$LOCAL_SHA" != "0000000000000000000000000000000000000000" ]]; then
SKIP=false
fi
done

if $SKIP; then
echo "Skipping tidy check for branch deletion"
exit 0
fi

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

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

0 comments on commit 41a7c83

Please sign in to comment.