-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
git_repository()
is sensitive to GIT_DIR
#24199
Labels
P2
We'll consider working on this in future. (Assignee optional)
team-ExternalDeps
External dependency handling, remote repositiories, WORKSPACE file.
type: bug
Comments
satyanandak
added
the
team-ExternalDeps
External dependency handling, remote repositiories, WORKSPACE file.
label
Nov 5, 2024
meteorcloudy
added
P2
We'll consider working on this in future. (Assignee optional)
and removed
untriaged
labels
Nov 5, 2024
bazel-io
pushed a commit
to bazel-io/bazel
that referenced
this issue
Nov 12, 2024
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 bazelbuild#24199. Closes bazelbuild#24204. PiperOrigin-RevId: 695642299 Change-Id: Id81e32194117cd8996408b236a6a88a20b14910b
github-merge-queue bot
pushed a commit
that referenced
this issue
Nov 13, 2024
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 Commit 89115d9 Co-authored-by: Richard Woodbury <[email protected]>
A fix for this issue has been included in Bazel 8.0.0 RC3. Please test out the release candidate and report any issues as soon as possible. |
ramil-bitrise
pushed a commit
to bitrise-io/bazel
that referenced
this issue
Dec 18, 2024
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 bazelbuild#24199. Closes bazelbuild#24204. PiperOrigin-RevId: 695642299 Change-Id: Id81e32194117cd8996408b236a6a88a20b14910b
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
P2
We'll consider working on this in future. (Assignee optional)
team-ExternalDeps
External dependency handling, remote repositiories, WORKSPACE file.
type: bug
Description of the bug:
If
GIT_DIR
happens to be set,git_repository()
may operate on the wrong clone. It is never useful forgit_repository()
to be influenced by theseGIT_
variables.It is notable that Git sets
GIT_DIR
and others when calling hooks. This complicates calling Bazel from within a hook (e.g.,bazel test
). In particular, when using Git worktrees, this can lead tocore.bare = true
being set, breaking the user's clone.Which category does this issue belong to?
No response
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Produces the following error:
Which operating system are you running Bazel on?
Debian Linux
What is the output of
bazel info release
?release 7.4.0
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?No response
If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: