libgit2 / pygit2

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

How to compute diff between Worktree and its index #1054

Closed pigay closed 2 years ago

pigay commented 3 years ago

Hi,

I have a bare Repository from which I created a Worktree.

I get its index with

index = Index(os.path.join(repo.path, 'worktrees', worktree.name))

When I try to run

index.diff_to_workdir()

I get ValueError('diff needs an associated repository')

Is there a way to connect Worktree's index to its filesystem directory? Did I miss something?

pigay commented 2 years ago

I really missed something: just have to open worktree as a Repository...