Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
git_repository()
ignore GIT_
env vars
This ensures that this repository rule cannot be influenced by these environment variables, particularly `GIT_DIR`, keeping the operation limited to the directory specified by the `repository_ctx`. In particular, this ensures that calling Bazel (e.g. `bazel test`) from within a Git hook will work reliably. Git hooks set `GIT_DIR` (among others), which can cause the repository rule's invocations of `git` to misbehave. https://git-scm.com/docs/githooks When using Git worktrees and calling Bazel from a Git hook, it has been observed that `git_repository()` will not only fail, but will also set `core.bare = true`, breaking the user's clone. Fixes #24199. Closes #24204. PiperOrigin-RevId: 695642299 Change-Id: Id81e32194117cd8996408b236a6a88a20b14910b
- Loading branch information