libgit2 / pygit2

Python bindings for libgit2
https://www.pygit2.org/
Other
1.58k stars 382 forks source link

add_worktree fails with non-bare repo #1147

Open vigneshraman opened 2 years ago

vigneshraman commented 2 years ago

I'm trying to add a worktree with

_pygit2.add_worktree(name, path, _pygit2.lookup_reference(ref))

ref is fetched using _pygit2.raw_listall_references(). This works for bare git repo.

In case of non-bare git repo, it fails with, _pygit2.GitError: reference is not a branch