Skip to content

fix(hooks): unset GIT_DIR in pre-push so integration tests don't inherit it#25

Merged
laulauland merged 1 commit intomainfrom
lau/fix-prepush-gitdir
Apr 17, 2026
Merged

fix(hooks): unset GIT_DIR in pre-push so integration tests don't inherit it#25
laulauland merged 1 commit intomainfrom
lau/fix-prepush-gitdir

Conversation

@laulauland
Copy link
Copy Markdown
Member

When git push invokes hooks/pre-push, git sets GIT_DIR=.git in the env. That env var leaks into zig build test, and into every subprocess it spawns — including the git commands that integration tests run against temp repos (via helpers.TempRepo). With GIT_DIR set, those subprocess git calls operate on this repo's .git instead of the test's temp directory, which breaks at least one test (check from nested subdir with its own drift.lock only checks that scope expected exit 1, got 0).

The hook passes when run directly but fails under git push. This mismatch hit me while cutting the v0.9.0 release.

Fix: unset GIT_DIR at the top of the hook.

@laulauland laulauland merged commit 80ec8f6 into main Apr 17, 2026
5 checks passed
@laulauland laulauland deleted the lau/fix-prepush-gitdir branch April 17, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant