Skip to content

support for git-worktree broken #33619

Closed
Closed
@sigmundch

Description

@sigmundch

Several on the team use git-worktree for our day-to-day workflow.

This recent change on how to calculate the dart-vm version broke support for git-worktree.

Here are some additional details:

why git-worktrees?
Worktrees allow to have many local folders working on a single git repo. It makes it very easy to switch context between branches and share them across working spaces without having to push and pull them from multiple git repos. They also support having separate gclient files, so they can all get build and tested separately. This is especially useful to do some parallel work: one can run test suites on one branch, while developing on another.

what broke?

It's no longer possible to build the sdk inside a worktree.

why things broke?
The way worktrees are implemented, is that the main git repo has all the information for each worktree under the .git folder. Each linked worktree just has a directory under the main git repo's .git/worktrees folder. However, the worktree itself doesn't have a .git folder, instead it as a .git file that says where the worktree folder is. For example:

git-repo/.git/ # a folder, the .git folder for the main git repo
git-repo/.git/worktrees/w1/  # a folder, a .git-like folder for the worktree w1
w1/.git  # a file, the contents point to git-repo/.git/worktrees/w1/

The breaking change assumes we can read a file under .git/logs/HEAD, this works in the default worktree, but fails in any other worktree where .git is a file and not a folder. Note there is a logs/HEAD file in the workspace's folder:

git-repo/.git/logs/HEAD # HEAD for the main git repo
git-repo/.git/worktrees/w1/logs/HEAD # HEAD for the w1 worktree.

@stereotype441 @zanderso

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-infrastructureUse area-infrastructure for SDK infrastructure issues, like continuous integration bot changes.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions