From cdde688964dafd4b6819f0b9315915ce616b9335 Mon Sep 17 00:00:00 2001 From: George Hickman Date: Thu, 15 Aug 2024 11:42:57 +0100 Subject: [PATCH] Remove git dir and work tree config from pre-commit hook (#4397) These variables effectively hardcode the location from which the script is run. We shouldn't need these since git should know that it is inside a repo when run. --- doc/development/setup.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/development/setup.rst b/doc/development/setup.rst index ae166d18cf..a691876f49 100644 --- a/doc/development/setup.rst +++ b/doc/development/setup.rst @@ -136,9 +136,7 @@ It is a good idea to put this command into your git hook ``.git/hooks/pre-commit for example, to check for any errors in any staged files when committing:: #!/bin/bash - cd $GIT_DIR/../src - export GIT_WORK_TREE=../ - export GIT_DIR=../.git + source ../env/bin/activate # Adjust to however you activate your virtual environment for file in $(git diff --cached --name-only | grep -E '\.py$' | grep -Ev "migrations|mt940\.py|pretix/settings\.py|make_testdata\.py|testutils/settings\.py|tests/settings\.py|pretix/base/models/__init__\.py|.*_pb2\.py") do