]> git.proxmox.com Git - rustc.git/blame - src/etc/pre-push.sh
New upstream version 1.65.0+dfsg1
[rustc.git] / src / etc / pre-push.sh
CommitLineData
29967ef6
XL
1#!/usr/bin/env bash
2#
04454e1e 3# Call `tidy --bless` before git push
6a06907d 4# Copy this script to .git/hooks to activate,
29967ef6
XL
5# and remove it from .git/hooks to deactivate.
6#
7
8set -Eeuo pipefail
9
10# https://github.com/rust-lang/rust/issues/77620#issuecomment-705144570
11unset GIT_DIR
12ROOT_DIR="$(git rev-parse --show-toplevel)"
f2b60f7d 13COMMAND="$ROOT_DIR/x.py test tidy"
29967ef6
XL
14
15if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
16 COMMAND="python $COMMAND"
04454e1e
FG
17elif ! command -v python &> /dev/null; then
18 COMMAND="python3 $COMMAND"
29967ef6
XL
19fi
20
5099ac24 21echo "Running pre-push script '$COMMAND'"
29967ef6
XL
22
23cd "$ROOT_DIR"
24
25$COMMAND