libgit2 / libgit2/libgit2sharp

Not seeing any branches, can't create branch

Đang mở
#1,658 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
C#
Star
3.5k
Fork
925
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với EncompassSettingsExport.GitWriter.cs dòng 52 và Program.cs dòng 71, sau đó kiểm tra thiết lập của Repository và kết quả của repo.Branches.Count(). Tái hiện nỗ lực tạo branch đối với private repository được mô tả và xác minh xem các branch hiện có có được liệt kê hay không, cũng như CreateBranch có thành công hay không; ghi lại lỗi hoặc bản sửa phù hợp bằng một regression test nếu project cung cấp test này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
csharp, git
Lĩnh vực
devtools
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.