about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-10-08 03:58:55 +0000
committerbors <bors@rust-lang.org>2020-10-08 03:58:55 +0000
commitcc662cd4540c6d3b8cb14cf535fa023699503dff (patch)
tree70a99b322507cc9089c4fb2f0225c4d39834c61f /src
parentd9985fc1081849532546d74c35a276694833c09d (diff)
parentf4989494bf21636763ba3ad5f9181c363b399257 (diff)
downloadrust-cc662cd4540c6d3b8cb14cf535fa023699503dff.tar.gz
rust-cc662cd4540c6d3b8cb14cf535fa023699503dff.zip
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`
Diffstat (limited to 'src')
-rwxr-xr-xsrc/etc/pre-commit.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/etc/pre-commit.sh b/src/etc/pre-commit.sh
index 5c5922a7e63..70b4e9d9908 100755
--- a/src/etc/pre-commit.sh
+++ b/src/etc/pre-commit.sh
@@ -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