Unset GIT_DIR in pre-commit hook

Works around https://github.com/rust-lang/rust/issues/77620
This commit is contained in:
Joshua Nelson 2020-10-07 19:50:27 -04:00
parent 4437b4b150
commit f4989494bf

View File

@ -7,15 +7,17 @@
set -Eeuo pipefail set -Eeuo pipefail
ROOT_DIR="$(git rev-parse --show-toplevel)"; # https://github.com/rust-lang/rust/issues/77620#issuecomment-705144570
COMMAND="$ROOT_DIR/x.py test tidy --bless"; unset GIT_DIR
ROOT_DIR="$(git rev-parse --show-toplevel)"
COMMAND="$ROOT_DIR/x.py test tidy --bless"
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
COMMAND="python $COMMAND" COMMAND="python $COMMAND"
fi fi
echo "Running pre-commit script '$COMMAND'"; echo "Running pre-commit script '$COMMAND'"
cd "$ROOT_DIR" cd "$ROOT_DIR"
$COMMAND; $COMMAND