Repository.resolve_refish does not return a commit if given annotated tag SHA
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ả
The repository.resolve_refish function is meant to return a commit object as the first element of the tuple ( source ).
However, if given a SHA of an annotated tag, it returns a tag object instead, which causes problems downstream.
The SHA of the target commit is available under result.target (see below)
How to reproduce:
Execute the following (clone the pygit2 repo into a temporary dir, create an annotated tag):
import pygit2
from pathlib import Path
import tempfile
repo_dir = tempfile.TemporaryDirectory()
repo_path = Path(repo_dir.name)
repo = pygit2.clone_repository("https://github.com/libgit2/pygit2.git", repo_path)
head_sha = repo.head.peel().id
old = repo.create_tag(
'test_annotated_tag',
head_sha,
pygit2.GIT_OBJ_COMMIT,
pygit2.Signature('John Doe', 'jdoe@example.com', 12347, 0),
'message'
)
commit, ref = repo.resolve_refish(str(old))
Then we can investigate the results:
In [2]: commit # not really a commit!
Out[2]: <pygit2.Object{tag:66986bf4eb1e47c3049f5a146609f0aa7b64757d}>
In [3]: commit.target
Out[3]: e2c0fdbfbd7f84374f8c7a3df256547b7ea99192
In [4]: head_sha
Out[4]: e2c0fdbfbd7f84374f8c7a3df256547b7ea99192
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 trong pygit2/repository.py, tại phần triển khai resolve_refish được tham chiếu trong issue. Tái hiện trường hợp SHA của annotated tag bằng script được cung cấp, sau đó lần theo object được trả về và target của nó. Được xem là hoàn tất khi phần tử đầu tiên của tuple là một commit object đối với trường hợp này và behavior hiện có vẫn được giữ nguyên đối với các đầu vào refish khác.
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
- 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
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 52/100