libgit2 / libgit2/libgit2sharp

Working Directory for a branch seems to be incorrect.

Open
#1,972 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Reproduce the listed work-tree scenario, then trace Repos.Branches and the branch Working Directory value to compare it with the Repository path. Done means a branch associated with a work tree reports that work tree's path rather than the repository's path, with regression coverage if the project has an applicable test location.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.