Reproduction steps
- Download and open attached Project
- Set target framework to net6 and run the project
Expected behavior
Worktrees.Add executes without exception
Actual behavior
Throws "LibGit2Sharp.LibGit2SharpException: reference is not a branch".
Version of LibGit2Sharp (release number or SHA1)
0.27.0-preview-0096
Operating system(s) tested; .NET runtime tested
Windows 10 Version 2004 (OS Build 19041.985) x64
usingLibGit2Sharp;usingSystem;usingSystem.IO;usingSystem.Linq;namespaceLibGit2SharpWorktreeIssue{classProgram{staticvoidMain(string[]args){varmainRepoPath=Path.Combine("..","RepoTest","Main");using(varrepo=newRepository(mainRepoPath)){try{varbranchName="r"+DateTimeOffset.Now.ToUnixTimeSeconds();varworkTreePath=Path.GetFullPath(Path.Combine(mainRepoPath,"..",branchName));//While debugging retry this line. It often works the second time.varnewWorkTree=repo.Worktrees.Add(branchName,workTreePath,false);}catch(Exceptionex){Console.WriteLine(ex);}}}}}LibGit2SharpWorktreeIssue.zip
Reproduction steps
Expected behavior
Worktrees.Add executes without exception
Actual behavior
Throws "LibGit2Sharp.LibGit2SharpException: reference is not a branch".
Version of LibGit2Sharp (release number or SHA1)
0.27.0-preview-0096
Operating system(s) tested; .NET runtime tested
Windows 10 Version 2004 (OS Build 19041.985) x64
LibGit2SharpWorktreeIssue.zip