You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed when calling Repository.ListRemoteReferences with a URL that doesn't point to a valid git repo, I get a fairly unhelpful error:
LibGit2Sharp.LibGit2SharpException: this remote has never connected
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
at LibGit2Sharp.Core.Proxy.git_remote_ls(Repository repository, RemoteHandle remote)
at LibGit2Sharp.Repository.ListRemoteReferences(String url, CredentialsHandler credentialsProvider)
at LibGit2Sharp.Repository.ListRemoteReferences(String url)
at LibGit2SharpScratchpad.Program.Main(String[] args)
I did some digging and noticed in Repository.ListRemoteReferences(string, CredentialsHandler), there is a call to git_remote_connect, then git_remote_ls. In git_remote_connect, if an exception is thrown (E.g: from the call to Ensure.ZeroResult(res)), it's caught and then ignored:
I've noticed when calling
Repository.ListRemoteReferences
with a URL that doesn't point to a valid git repo, I get a fairly unhelpful error:I did some digging and noticed in
Repository.ListRemoteReferences(string, CredentialsHandler)
, there is a call togit_remote_connect
, thengit_remote_ls
. Ingit_remote_connect
, if an exception is thrown (E.g: from the call toEnsure.ZeroResult(res)
), it's caught and then ignored:libgit2sharp/LibGit2Sharp/Core/Proxy.cs
Lines 2163 to 2176 in 6329bea
It looks like this was introduced in this commit: 6bc517f
Because this doesn't re-throw the exception,
git_remote_ls
gets given anull
transport, and thus throws thethis remote has never connected
error.I would've expected this to re-throw the exception after disposing of the custom headers.
Seems like an easy fix and I'm happy to send through a PR, just wondering if this was intentional or a legitimate bug.
The text was updated successfully, but these errors were encountered: