Skip to content

Commit

Permalink
Unset GIT_DIR in pre-commit hook
Browse files Browse the repository at this point in the history
Works around #77620
  • Loading branch information
jyn514 committed Oct 7, 2020
1 parent 4437b4b commit f498949
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/etc/pre-commit.sh
Expand Up @@ -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

0 comments on commit f498949

Please sign in to comment.