buildbuddy-io / buildbuddy

BuildBuddy is an open source Bazel build event viewer, result store, remote cache, and remote build execution platform.

Home Page:https://buildbuddy.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[CLI] `bb login` fails in `git-worktree` linked worktrees.

asford opened this issue · comments

The bb login command fails when using a git worktree,
because git worktree replaces the .git directory with a file-based pointer to the worktree root in linked worktrees.

$ bazel login
Enter your API key from https://app.buildbuddy.io/settings/cli-login: $SEKRAT
failed to write API key to local .git/config: failed to determine git repo root: "/absolute/path/to/worktree_checkout/.git" is not a directory

$ bazel version
Bazelisk version: v1.19.0
bb 5.0.25
Build label: 5.4.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Dec 15 16:14:25 2022 (1671120865)
Build timestamp: 1671120865
Build timestamp as int: 1671120865

$ cat .git
gitdir: /absolute/path/to/main/.git/worktrees/worktree_checkout

$ git rev-parse --git-dir
 /absolute/path/to/main/.git/worktrees/worktree_checkout

Hey @asford I just merged a fix over at #6284

I will let you know when a newer version of our CLI is released so that you could test it against your setup.

Thanks for reporting!

@asford We have created a new CLI release https://github.com/buildbuddy-io/bazel/releases/tag/5.0.44 that includes the fix.

Could you please update your CLI and try using it against your git-worktree checkout?