Commit 0fda24f
committed
tests: set GIT_CEILING_DIRECTORIES to prevent repo discovery
When running `npm test` from a Git worktree, test-spawned git processes
that happened to operate at or above `.test-dir/` would walk up the
directory tree and discover the enclosing real repository. In a worktree
setup this is particularly dangerous because the `.git/config` is shared
across all worktrees, so any accidental config write (e.g. `core.bare`)
affects every checkout.
Prevent this by setting `GIT_CEILING_DIRECTORIES` to every ancestor of
the `.test-dir/` temporary directory. The temp dir itself is excluded so
that git can still discover the test repositories created inside it.
Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>1 parent 810cb3d commit 0fda24f
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
144 | 151 | | |
145 | 152 | | |
146 | 153 | | |
| |||
0 commit comments