Repository navigation
Commit 4bf812c
committed
[githooks] Support git worktrees and relative hooksPath
Currently, setup.py sets core.hooksPath using an absolute filesystem path in the repository configuration.
In environments with Git worktrees, repository configuration (.git/config) is shared across all worktrees. Setting core.hooksPath globally in .git/config impacts all worktrees, even those where engine dependencies (such as the Dart SDK fetched via gclient sync) have not been installed. Git operations in unconfigured worktrees (or the root repository) then fail when attempting to run non-existent hook binaries.
This change:
- Detects if running inside a Git worktree.
- Enables extensions.worktreeConfig and applies git config --worktree to scope core.hooksPath strictly to the active worktree.
- Uses a relative path from the repository root for core.hooksPath with forward slashes for cross-platform portability.1 parent 72dc94b commit 4bf812c
1 file changed
Lines changed: 50 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
26 | 50 | | |
27 | 51 | | |
28 | 52 | | |
| |||
34 | 58 | | |
35 | 59 | | |
36 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
37 | 80 | | |
38 | 81 | | |
39 | 82 | | |
40 | 83 | | |
| 84 | + | |
| 85 | + | |
41 | 86 | | |
42 | 87 | | |
43 | 88 | | |
| |||
47 | 92 | | |
48 | 93 | | |
49 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
50 | 98 | | |
51 | 99 | | |
52 | | - | |
| 100 | + | |
53 | 101 | | |
54 | | - | |
| 102 | + | |
55 | 103 | | |
56 | 104 | | |
57 | 105 | | |
| |||
0 commit comments