Skip to content

get_git_root_path should support worktrees #169

Open

Description

@madig

Git supports the concept of multiple working directories connected to different branches of the same repo: https://git-scm.com/docs/git-worktree.

get_git_root_path currently fails to handle it properly and raises OSError: Unable to determine git repository root for font file ....

Activity

  1. chrissimpkins commented on Nov 25, 2021

    @chrissimpkins
    Member

    related #168

    how do you use this approach in your workflows Nikolaus?

  2. chrissimpkins commented on Nov 25, 2021

    @chrissimpkins
    Member

    It looks like this is config'd via the .git dir in the main directory from which the worktree branches are derived? Wondering if this means that there is a more general / global config approach?

  3. madig commented on Jan 25, 2023

    @madig
    Author

    Seems like .git in a worktree is a file with the pointer to the main repo. You can extract the path with https://gitpython.readthedocs.io/en/stable/reference.html?highlight=worktree#git.repo.fun.find_worktree_git_dir from that file. You still have to fiddle with the path though, as it points to somewhere inside the main .git dir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions