Repository.merge_file_from_index - can't take a None as an argument
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 1.7k
- Fork
- 408
- Merge trung bình
- 2 ngày 57 phút
- Pull request đã merge (30 ngày)
- 7
Mô tả
This is probably more of a libgit2 question but given that I am working on pygit2, I better start the conversation over here.
I am working on writing unit tests for Repository.merge_file_from_index. I want to add a test for a deleted file. The signature of the method provides for None as a valid argument:
def merge_file_from_index(
self,
ancestor: typing.Union[None, IndexEntry],
ours: typing.Union[None, IndexEntry],
theirs: typing.Union[None, IndexEntry],
) -> str:
So I have this:
def test_merge_file_from_index(testrepo):
hello_txt = testrepo.index["hello.txt"]
# deleting the file on theirs
res = testrepo.merge_file_from_index(hello_txt, hello_txt, None)
assert res == ""
And I am getting this when I run the test:
> raise GitError(message)
E _pygit2.GitError: invalid argument: 'theirs'
Am I wrong in my understanding from the signature that None is a correct value?
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Đọc pygit2/repository.py quanh dòng 682 và chạy bài kiểm thử được hiển thị cho Repository.merge_file_from_index. Kiểm tra xem phần triển khai có chấp nhận None cho đối số theirs như chữ ký chỉ ra hay không; hoàn thành khi hành vi và bài kiểm thử khớp nhau trong trường hợp tệp bị xóa.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- git, python
- Lĩnh vực
- tooling
- 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
- 38/100