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)、ListReferencesInternal 以及 stack trace 中顯示的 git_remote_ls 呼叫開始。使用提供的範例重現第一次呼叫和後續呼叫,然後追蹤 remote 的間歇性狀態;當原因已確認,且該失敗已有回歸測試或清楚記錄的解決方案時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp, git
領域
networking
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。