bazelbuild/bazel
View on GitHubCreating a git branch that ends in "BUILD" confuses Bazel
Open
#23,431 opened on Aug 26, 2024
P3help wantedteam-Coreteam-OSStype: bug
Repository metrics
- Stars
- (25,384 stars)
- PR merge metrics
- (Avg merge 22d 20h) (77 merged PRs in 30d)
Description
Description of the bug:
If you create a git branch like ob/BUILD or ob/build (on macOS where the file system is case insensitive) bazel thinks it's a build file and chokes on it.
Which category does this issue belong to?
Core
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
$ git init demo
$ cd demo
$ touch MODULE.bazel WORKSPACE
$ git add -A
$ git commit -am "init bazel repo"
[main (root-commit) f45e299] init bazel repo
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 MODULE.bazel
create mode 100644 WORKSPACE
$ git checkout -b ob/build
Switched to a new branch 'ob/build'
$ bazel build //...
ERROR: /Users/obonilla/tmp/demo/.git/logs/refs/heads/ob/BUILD:1:1: invalid octal literal: 0000000000000000000000000000000000000000 (use '0o000000000000000000000000000000000000000')
ERROR: /Users/obonilla/tmp/demo/.git/logs/refs/heads/ob/BUILD:1:42: syntax error at 'f45e29939884f14e45e1dac396a2534ce168ee1c': expected newline
ERROR: /Users/obonilla/tmp/demo/.git/logs/refs/heads/ob/BUILD:1:104: invalid character: '@'
ERROR: /Users/obonilla/tmp/demo/.git/logs/refs/heads/ob/BUILD:1:128: invalid octal literal: 0700 (use '0o700')
ERROR: /Users/obonilla/tmp/demo/.git/logs/refs/heads/ob/BUILD:1:149: keyword 'from' not supported
ERROR: /Users/obonilla/tmp/demo/.git/refs/heads/ob/BUILD:1:1: name 'f45e29939884f14e45e1dac396a2534ce168ee1c' is not defined
ERROR: package contains errors: .git/logs/refs/heads/ob
ERROR: package contains errors: .git/refs/heads/ob
WARNING: Target pattern parsing failed.
ERROR: Skipping '//...': Error evaluating '//...': error loading package '.git/logs/refs/heads/ob': Package '.git/logs/refs/heads/ob' contains errors
ERROR: Error evaluating '//...': error loading package '.git/logs/refs/heads/ob': Package '.git/logs/refs/heads/ob' contains errors
INFO: Elapsed time: 2.027s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
Which operating system are you running Bazel on?
macOS
What is the output of bazel info release?
release 7.3.1
If bazel info release returns development 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