bazelbuild/bazel

Creating a git branch that ends in "BUILD" confuses Bazel

Open

#23,431 创建于 2024年8月26日

在 GitHub 查看
 (3 评论) (1 反应) (0 负责人)Java (4,465 fork)batch import
P3help wantedteam-Coreteam-OSStype: bug

仓库指标

Star
 (25,384 star)
PR 合并指标
 (平均合并 22天 20小时) (30 天内合并 77 个 PR)

描述

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

贡献者指南