Suggestion: better handling of `repo.set_head(pygit2.Commit)`
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ả
I have tried to emulate git checkout --detach <commit> in pygit2, to create detached HEAD checkout, and I did come up with the following rough equivalent (though the following does not uses transactions as git does):
rev = repo.revparse_single(commit_name)
repo.checkout_tree(rev)
repo.set_head(rev.id)
However when I tried to use simply repo.set_head(rev), I got the following error:
TypeError Traceback (most recent call last)
<ipython-input-35-9612528ec0ac> in <module>()
----> 1 repo.set_head(rev)
/usr/lib/python2.7/dist-packages/pygit2/repository.pyc in set_head(self, target)
293
294 # if it's a string, then it's a reference name
--> 295 err = C.git_repository_set_head(self._repo, to_bytes(target))
296 check_error(err)
297
TypeError: initializer for ctype 'char *' must be a cdata pointer, not _pygit2.Commit
It would be nice if pygit2.Commit object was automatically peeled, but if it is decided to be not good idea, then what it needs is more user-friendly error message than the one above.
pygit2 0.26.0
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
Bắt đầu tại Repository.set_head trong traceback của repository.py và so sánh luồng revparse_single, checkout_tree và C.git_repository_set_head được hiển thị. Kiểm tra các test hoặc tài liệu hiện có để biết những kiểu đích được chấp nhận; công việc được xem là hoàn tất khi hành vi đầu vào Commit đã được xác định và có test bao phủ, bao gồm cả thông báo lỗi rõ ràng nếu nó vẫn không được hỗ trợ.
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
- Tính năng
- Độ 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