libgit2 / libgit2/libgit2sharp

Reading Branch.UpstreamBranchCanonicalName throws an exception

未關閉
#1,559 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

Up for grabs
主要語言
C#
星號
3.5k
分支
925
PR 合併指標
30 天內沒有已合併 PR

描述

LibGit2 0.24.0. In C#, when I access the UpstreamBranchCanonicalName property on Branch I get this exception:

Message        : Value cannot be null.                                      
                 Parameter name: name                                       
ParamName      : name                                                       
Data           : {}                                                         
InnerException :                                                            
TargetSite     : System.String get_UpstreamBranchCanonicalName()            
StackTrace     :    at LibGit2Sharp.Branch.get_UpstreamBranchCanonicalName()
                    at LibGit2.Automation.BranchInfo..ctor(Branch branch)   
HelpLink       :                                                            
Source         : LibGit2Sharp                                               
HResult        : -2147467261                                                

I am enumerating the branches in PowerShell:

            $repo.Branches |
                ForEach-Object { New-Object LibGit2.Automation.BranchInfo $_ }

The constructor for my LibGit2.Automation.BranchInfo object is where Branch throws an exception:

        public BranchInfo(Branch branch)
        {
            Name = branch.FriendlyName;
            CanonicalName = branch.CanonicalName;
            UpstreamBranchCanonicalName = branch.UpstreamBranchCanonicalName;
            IsRemote = branch.IsRemote;
            IsTracking = branch.IsTracking;
            IsCurrentRepositoryHead = branch.IsCurrentRepositoryHead;
            Tip = new CommitInfo(branch.Tip);
        }

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

首先,透過 LibGit2.Automation.BranchInfo 建構函式列舉 repo.Branches 來重現例外,重點關注報告中顯示的 Branch.UpstreamBranchCanonicalName 存取。驗證會觸發 null 名稱錯誤的分支行為,並確認分支列舉能在不發生例外的情況下完成。

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

評估

技術堆疊
csharp, git
領域
devtools
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
42/100

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

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