Skip to content

Commit 8820e7f

Browse files
committed
fix githook for worktree case
1 parent 04fa43c commit 8820e7f

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

.githooks/pre-push-python/extras.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# ensure generated pyproject.toml extras are up-to-date
22

3+
# Clear git env vars set by the parent hook so git commands resolve the work tree normally
4+
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_PREFIX
5+
36
# Store the root directory of the repository
47
REPO_ROOT="$(git rev-parse --show-toplevel)"
58
PYTHON_DIR="$REPO_ROOT/python"

.githooks/pre-push-python/fmt-lint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
set -e
44

5+
# Clear git env vars set by the parent hook so git commands resolve the work tree normally
6+
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_PREFIX
7+
58
# Store the root directory of the repository
69
REPO_ROOT="$(git rev-parse --show-toplevel)"
710
PYTHON_DIR="$REPO_ROOT/python"

.githooks/pre-push-python/stubs.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# ensure generated python stubs are up-to-date, from sync clients
22

3+
# Clear git env vars set by the parent hook so git commands resolve the work tree normally
4+
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_PREFIX
5+
36
# Store the root directory of the repository
47
REPO_ROOT="$(git rev-parse --show-toplevel)"
58
PYTHON_DIR="$REPO_ROOT/python"

0 commit comments

Comments
 (0)