libgit2 / libgit2/libgit2sharp
Remotes are sometimes not returned for worktree
Open
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 3.5k
- Forks
- 925
- PR merge metrics
- No merged PRs in 30d
Description
Reproduction steps
- Create repository with remote and commit.
- Create branch and create a worktree from that branch.
- Copy the path to worktree and run the following code:
var worktreePath = "Here is your worktree path";
var repositoryPath = Repository.Discover(worktreePath);
var repo = new Repository(repositoryPath);
var before = repo.Network.Remotes.ToArray();
_ = repo.Head.RemoteName;
var after = repo.Network.Remotes.ToArray();
Expected behavior
Both before and after variable contain remote.
Actual behavior
The before variable contains remote, after is empty.
Version of LibGit2Sharp (release number or SHA1)
Latest master: 7f59d22c4fdb7b3d14511aca567e64eefaa43ab2
Operating system(s) tested; .NET runtime tested
Windows, .NET Framework 462 and .NET Core 2.1. I believe it doesn't matter.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the reported C# reproduction on the latest master, focusing on Repository.Discover, repo.Network.Remotes, and repo.Head.RemoteName with a linked worktree. Trace why accessing Head.RemoteName changes the remotes result; done when both before and after contain the repository remote.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, git
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100