Skip to content

Support for worktrees #647

Description

@wavexx

I'm a heavy user of worktrees, and recently started working on a project that uses subrepo. While it works, it doesn't seem subrepo fully supports working with a repository with multiple worktrees containing the same subrepo:

  • using --git-common-dir places the subrepo's worktree where it's shared among other git worktrees: if I have two worktrees checked out at two different branches, each branch can contain a different .gitrepo (different revision, for example, or different upstream branch). I want to obviously be able to work with both worktrees independently. This seems easily solvable by placing subrepo's worktree within the current toplevel, which would also make the subrepo worktree location less awkward to use in such configuration.
  • subrepo "branch" is similarly affected: again, I might have checked out two worktrees which have a conflicting or completely different content for the same subrepo name. Since git branch names are unique in the repository, to make subrepo handle each worktree independently it would also have to use a unique name for each worktree.

While the first seems easily solvable, I'm not sure about the second. A unique prefix or suffix would do, however it's not clear what could be used to generate it from the current worktree in a good way. Maybe a truncated hash of the worktree path itself?

Is there interest in fixing such scenarios and/or something that I've missed from the documentation to avoid these issues?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions