diff options
| author | Yotam Ofek <yotam.ofek@gmail.com> | 2025-02-25 13:08:59 +0000 |
|---|---|---|
| committer | Yotam Ofek <yotam.ofek@gmail.com> | 2025-02-25 13:48:31 +0000 |
| commit | 41a7c8312d9b21bbf96da0d39b5650dde03ec7ef (patch) | |
| tree | 6d4d76e159007a51e0ee5f07dfdeaaf1e128b5d5 | |
| parent | ad27045c31a9f37ad7d44ca2a403de52d1a896d3 (diff) | |
| download | rust-41a7c8312d9b21bbf96da0d39b5650dde03ec7ef.tar.gz rust-41a7c8312d9b21bbf96da0d39b5650dde03ec7ef.zip | |
Skip `tidy` in pre-push hook if the user is deleting a remote branch
| -rwxr-xr-x | src/etc/pre-push.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/etc/pre-push.sh b/src/etc/pre-push.sh index 6f86c7ab8a4..7bacc943f25 100755 --- a/src/etc/pre-push.sh +++ b/src/etc/pre-push.sh @@ -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" |
