`x.py setup` hardlinks this file into .git/hooks. Prior to this commit,
that led to the following warning emitted by `git commit`:
hint: The '.git/hooks/pre-commit' hook was ignored because it's not set as executable.
Making the checked-in script executable fixes this issue, as the
hardlinked copy uses the same flags.
It looks like the file was originally executable, but that bit was
unset in commit b908905b3d of
https://github.com/rust-lang/rust/pull/85305. It's possible that was
unintentional.
23 lines
514 B
Bash
Executable file
23 lines
514 B
Bash
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# Call `tidy --bless` before each commit
|
|
# Copy this script to .git/hooks to activate,
|
|
# and remove it from .git/hooks to deactivate.
|
|
#
|
|
|
|
set -Eeuo pipefail
|
|
|
|
# https://github.com/rust-lang/rust/issues/77620#issuecomment-705144570
|
|
unset GIT_DIR
|
|
ROOT_DIR="$(git rev-parse --show-toplevel)"
|
|
COMMAND="$ROOT_DIR/x.py test tidy --bless"
|
|
|
|
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
|
|
COMMAND="python $COMMAND"
|
|
fi
|
|
|
|
echo "Running pre-commit script '$COMMAND'"
|
|
|
|
cd "$ROOT_DIR"
|
|
|
|
$COMMAND
|