Auto merge of #77683 - jyn514:git-hook, r=Mark-Simulacrum

Unset GIT_DIR in pre-commit hook

Works around https://github.com/rust-lang/rust/issues/77620. This won't help any other hooks you write manually, but hopefully people won't feel the need to do that now there's an 'official' one.

r? `@Mark-Simulacrum`
cc `@caass`
This commit is contained in:
bors 2020-10-08 03:58:55 +00:00
commit cc662cd454

View File

@ -7,15 +7,17 @@
set -Eeuo pipefail
ROOT_DIR="$(git rev-parse --show-toplevel)";
COMMAND="$ROOT_DIR/x.py test tidy --bless";
# 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'";
echo "Running pre-commit script '$COMMAND'"
cd "$ROOT_DIR"
$COMMAND;
$COMMAND