libgit2 / libgit2sharp

Git + .NET = ❤
http://libgit2.github.com
MIT License
3.13k stars 879 forks source link

Working Directory for a branch seems to be incorrect. #1972

Open devmikew opened 2 years ago

devmikew commented 2 years ago

I think there is an error in the Working Directory for a branch, particularly if a branch is associated with a WorkTree.

It always shows the same path as the Repository. However if a branch is associated with a work tree, it's working directory is probably not the same as the repository.

  1. Create a work tree and an associated branch.
  2. Create the Repository in code (pointing to the Repositories path).
  3. Examine all the branches by iterating through Repos.Branches.
  4. The working directory of the new branch is pointing to the working directory of the Repository, not the path to the work tree.

Version of LibGit2Sharp (release number or SHA1)

<PackageReference Include="LibGit2Sharp" Version="0.26.2" />

Operating system(s) tested; .NET runtime tested

VS 2022, Win 11

net6.0-windows10.0.19041.0

I know how to get the correct path if you think it is a bug.