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

Commit 5e68be4

Browse files
committed
bugfix - do not resolve remote nick if it contains "/"
A user can set their upstream during a push by using the full URL and adding --set-upstream. This adds a config value and bypasses all the existing remote lookup checks in libgit2. This means an error occurs when trying to resolve the URL to a remote nick. We should return a null remote here. This might also be necessary to fix in libgit2, but for now i'm just yoloing things.
1 parent ed294d1 commit 5e68be4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

LibGit2Sharp/Branch.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,16 @@ public virtual Remote Remote
177177
return null;
178178
}
179179

180+
// upstream git uses the "/" character to denote
181+
// when a nick should not be resolved to a remote
182+
// TODO:
183+
// there's probably some pushspec stuff still to
184+
// address here, but let me make this bugfix first
185+
if (remoteName.Contains("/"))
186+
{
187+
return null;
188+
}
189+
180190
return repo.Network.Remotes[remoteName];
181191
}
182192
}

0 commit comments

Comments
 (0)