]> git.lizzy.rs Git - rust.git/blob - src/etc/pre-commit.sh
Fix feature gate checking of static-nobundle and native_link_modifiers
[rust.git] / src / etc / pre-commit.sh
1 #!/usr/bin/env bash
2 #
3 # Call `tidy --bless` before each commit
4 # Copy this script to .git/hooks to activate,
5 # and remove it from .git/hooks to deactivate.
6 #
7
8 set -Eeuo pipefail
9
10 # https://github.com/rust-lang/rust/issues/77620#issuecomment-705144570
11 unset GIT_DIR
12 ROOT_DIR="$(git rev-parse --show-toplevel)"
13 COMMAND="$ROOT_DIR/x.py test tidy --bless"
14
15 if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
16   COMMAND="python $COMMAND"
17 fi
18
19 echo "Running pre-commit script '$COMMAND'"
20
21 cd "$ROOT_DIR"
22
23 $COMMAND