libgit2 / libgit2/libgit2sharp

repo.Network.ListReferences(remote) throwing exception "this remote has never connected" intermittently

未关闭
#1,668 0 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
C#
星标
3.5k
派生
925
PR 合并指标
30 天内没有已合并 PR

描述

Calling repo.Network.ListReferences(remote) throws exception "this remote has never connected" intermittently. This is how I have called it ... if it matters

          string localRepoPath = "path to cloned folder";
          string remoteName = "origin";            
            using (Repository repo = new Repository(localRepoPath))
            {
                remoteName = repo.Network.Remotes.FirstOrDefault()?.Name ?? remoteName;
                Remote remote = repo.Network.Remotes[remoteName];                
                List<Reference> references = repo.Network.ListReferences(remote).ToList();
				
				// some more code logic here
			}

So am calling the overload of ListReferences(Remote remote) which essentially calls ListReferencesInternal(string url, CredentialsHandler credentialsProvider) passing null to CredentialsHandler. Should this be an issue? Don't think so since it's working in second try or so. Relevant exception stack trace below

{
"Depth": 1,
"ClassName": "",
"Message": "this remote has never connected",
"Source": "LibGit2Sharp",
"StackTraceString": " at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)\r\n at LibGit2Sharp.Core.Proxy.git_remote_ls(Repository repository, RemoteHandle remote)\r\n at LibGit2Sharp.Network.ListReferencesInternal(String url, CredentialsHandler credentialsProvider)\r\n

Please suggest, what's wrong is going on (Or) if you need further information from my end.

Found this existing issue https://github.com/libgit2/libgit2sharp/issues/1504 but am not passing any credential, and it's a public repo which am trying to access.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 Network.ListReferences(Remote)、ListReferences 和 stack trace 中显示的 git_remote_ls 调用开始。使用提供的示例重现第一次调用以及后续调用,然后跟踪 remote 的间歇性状态;当确定原因,并且该失败有回归测试或明确记录的解决方案时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
csharp, git
领域
networking
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。