Skip to content

Commit 1305212

Browse files
authored
Rollup merge of #137618 - yotamofek:pr/pre-push-hook, r=Mark-Simulacrum
Skip `tidy` in pre-push hook if the user is deleting a remote branch It's kinda annoying when I'm trying to delete remote branches and that triggers `tidy`, so small fix to prevent that. Hopefully this should be an acceptable amount of complexity to add to this shell script.
2 parents 7dd5868 + 41a7c83 commit 1305212

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: src/etc/pre-push.sh

+14
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@
77

88
set -Euo pipefail
99

10+
# Check if the push is doing anything other than deleting remote branches
11+
SKIP=true
12+
while read LOCAL_REF LOCAL_SHA REMOTE_REF REMOTE_SHA; do
13+
if [[ "$LOCAL_REF" != "(delete)" || \
14+
"$LOCAL_SHA" != "0000000000000000000000000000000000000000" ]]; then
15+
SKIP=false
16+
fi
17+
done
18+
19+
if $SKIP; then
20+
echo "Skipping tidy check for branch deletion"
21+
exit 0
22+
fi
23+
1024
ROOT_DIR="$(git rev-parse --show-toplevel)"
1125

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

0 commit comments

Comments
 (0)