Closed
Description
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
using LibGit2Sharp;
using System;
using System.IO;
using System.Linq;
namespace LibGit2SharpWorktreeIssue {
class Program {
static void Main(string[] args) {
var mainRepoPath = Path.Combine("..", "RepoTest", "Main");
using(var repo = new Repository(mainRepoPath)) {
try {
var branchName = "r" + DateTimeOffset.Now.ToUnixTimeSeconds();
var workTreePath = Path.GetFullPath(Path.Combine(mainRepoPath, "..", branchName));
//While debugging retry this line. It often works the second time.
var newWorkTree = repo.Worktrees.Add(branchName, workTreePath, false);
} catch(Exception ex) {
Console.WriteLine(ex);
}
}
}
}
}
Metadata
Metadata
Assignees
Labels
No labels