libgit2 / libgit2/libgit2sharp
Reading Branch.UpstreamBranchCanonicalName throws an exception
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 3.5k
- Forks
- 925
- PR merge metrics
- No merged PRs in 30d
Description
LibGit2 0.24.0. In C#, when I access the UpstreamBranchCanonicalName property on Branch I get this exception:
Message : Value cannot be null.
Parameter name: name
ParamName : name
Data : {}
InnerException :
TargetSite : System.String get_UpstreamBranchCanonicalName()
StackTrace : at LibGit2Sharp.Branch.get_UpstreamBranchCanonicalName()
at LibGit2.Automation.BranchInfo..ctor(Branch branch)
HelpLink :
Source : LibGit2Sharp
HResult : -2147467261
I am enumerating the branches in PowerShell:
$repo.Branches |
ForEach-Object { New-Object LibGit2.Automation.BranchInfo $_ }
The constructor for my LibGit2.Automation.BranchInfo object is where Branch throws an exception:
public BranchInfo(Branch branch)
{
Name = branch.FriendlyName;
CanonicalName = branch.CanonicalName;
UpstreamBranchCanonicalName = branch.UpstreamBranchCanonicalName;
IsRemote = branch.IsRemote;
IsTracking = branch.IsTracking;
IsCurrentRepositoryHead = branch.IsCurrentRepositoryHead;
Tip = new CommitInfo(branch.Tip);
}
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 reproducing the exception while enumerating repo.Branches through the LibGit2.Automation.BranchInfo constructor, focusing on the Branch.UpstreamBranchCanonicalName access shown in the report. Verify behavior for branches that trigger the null-name error and confirm that branch enumeration completes without the exception.
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
- 42/100