Skip to content

Commit cc662cd

Browse files
committed
Auto merge of #77683 - jyn514:git-hook, r=Mark-Simulacrum
Unset GIT_DIR in pre-commit hook Works around #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`
2 parents d9985fc + f498949 commit cc662cd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/etc/pre-commit.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77

88
set -Eeuo pipefail
99

10-
ROOT_DIR="$(git rev-parse --show-toplevel)";
11-
COMMAND="$ROOT_DIR/x.py test tidy --bless";
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"
1214

1315
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
1416
COMMAND="python $COMMAND"
1517
fi
1618

17-
echo "Running pre-commit script '$COMMAND'";
19+
echo "Running pre-commit script '$COMMAND'"
1820

1921
cd "$ROOT_DIR"
2022

21-
$COMMAND;
23+
$COMMAND

0 commit comments

Comments
 (0)