Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_git_root_path should support worktrees #169

Open
madig opened this issue Nov 25, 2021 · 3 comments · May be fixed by #238
Open

get_git_root_path should support worktrees #169

madig opened this issue Nov 25, 2021 · 3 comments · May be fixed by #238

Comments

@madig
Copy link

madig commented Nov 25, 2021

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 ....

@chrissimpkins
Copy link
Member

related #168

how do you use this approach in your workflows Nikolaus?

@chrissimpkins
Copy link
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?

@madig
Copy link
Author

madig commented Jan 25, 2023

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.

@RickyDaMa RickyDaMa linked a pull request Mar 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants