Skip to content
This repository was archived by the owner on Feb 3, 2023. It is now read-only.

Commit 831f1e7

Browse files
committed
bugfix - handle and discard exception that occurs when user has
configured the remote to be a branch instead of a nick Due to the contract with libgit2 indicating it will return GIT_EINVALIDSPEC for this scenario, I'm just going to handle this and bail out of the rest of the tracking flow until I get a good chance to discuss this upstream
1 parent 5e68be4 commit 831f1e7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

LibGit2Sharp/Branch.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,17 @@ private Branch ResolveTrackedBranch()
236236
return null;
237237
}
238238

239-
string trackedReferenceName = Proxy.git_branch_upstream_name(repo.Handle, CanonicalName);
239+
string trackedReferenceName = null;
240+
try
241+
{
242+
trackedReferenceName = Proxy.git_branch_upstream_name(repo.Handle, CanonicalName);
243+
}
244+
catch (InvalidSpecificationException)
245+
{
246+
// we have no way to pro-actively check this
247+
// based on the information available
248+
// so we just need to handle this here
249+
}
240250

241251
if (trackedReferenceName == null)
242252
{

0 commit comments

Comments
 (0)