libgit2 / libgit2/libgit2sharp
Not seeing any branches, can't create branch
還沒有人認領這個 Issue。
- 主要語言
- C#
- 星號
- 3.5k
- 分支
- 925
- PR 合併指標
- 30 天內沒有已合併 PR
描述
I am running into the following error when i try to create a branch...
LibGit2Sharp.NotFoundException: revspec 'master' not found
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
at LibGit2Sharp.Core.Proxy.git_annotated_commit_from_revspec(RepositoryHandle repo, String revspec)
at LibGit2Sharp.Core.Proxy.git_branch_create_from_annotated(RepositoryHandle repo, String branch_name, String targetIdentifier, Boolean force)
at LibGit2Sharp.BranchCollection.Add(String name, String committish, Boolean allowOverwrite)
at LibGit2Sharp.BranchCollection.Add(String name, String committish)
at LibGit2Sharp.RepositoryExtensions.CreateBranch(IRepository repository, String branchName)
at EncompassSettingsExport.GitWriter..ctor(String PathToRepo, Signature Signature, CredentialsHandler credentialsHandler, String Branch, String SupplimentalPath, ILogger logger, Boolean purgeDirectory) in C:\Users\barnao\Downloads\EncompassSettingsExport2\EncompassSettingsExport\EncompassSettingsExport\GitWriter.cs:line 52
at EncompassSettingsExport.Program.<Run>d__1.MoveNext() in C:\Users\barnao\Downloads\EncompassSettingsExport2\EncompassSettingsExport\EncompassSettingsExport\Program.cs:line 71
Finished! Press any key to exit...
The line of code that produces this error is
brnch = repo.CreateBranch(Branch)
Where Branch is just a string like "test-brnch" and repo is a Repository object i've already created.
I am checking to make sure i can see my repo here (it is a private non-local repo)
Repository.IsValid(PathToRepo)
and this returns true.
I create my repo here...
repo = new Repository(PathToRepo);
However i've noticed that when i call
repo.Branches.Count();
This return 0 even though i do have a few branches in my repo
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 EncompassSettingsExport.GitWriter.cs 第 52 行和 Program.cs 第 71 行開始,接著檢查 Repository 的設定以及 repo.Branches.Count() 的結果。針對所述的私有儲存庫重現建立分支的嘗試,並驗證是否會列舉現有分支,以及 CreateBranch 是否成功;如果專案提供回歸測試,請使用回歸測試記錄相關的失敗或修正。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- csharp, git
- 領域
- devtools
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100