Skip to content

Commit

Permalink
Auto merge of rust-lang#77683 - jyn514:git-hook, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Unset GIT_DIR in pre-commit hook

Works around rust-lang#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`
  • Loading branch information
bors committed Oct 8, 2020
2 parents d9985fc + f498949 commit cc662cd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/etc/pre-commit.sh
Original file line number Diff line number Diff line change
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 cc662cd

Please sign in to comment.