Repository.resolve_refish can return a Tag, violates docstring and typehint
オープン
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 1.7k
- フォーク
- 408
- 平均マージ
- 2日 57分
- マージ済み PR(30日)
- 7
説明
The typing hint and docstring of Repository.resolve_refish says it returns a Commit object. Actually, it will return a Tag object if given a tag's hex oid. Is this the expected behavior.
For example, in the Linux kernel:
assert pygit2.__version__ == "1.18.0"
# OID of `v6.12.1^{tag}` and v6.12.1^{commit}` in Linux kernel.
tag_oid = Oid(hex="a554dea023a451ad985c071f8aae6415f0e274df")
commit_oid = Oid(hex="d390303b28dabbb91b2d32016a4f72da478733b9")
# As documented, symbolic refs resolve to a commit object.
# But the ref target differs from the returned object. Is this the desired behavior?
obj, ref = repo.resolve_refish("v6.12.1")
assert isinstance(obj, Commit)
assert ref.target != obj.id
assert ref.target == tag_oid
# Contrary to the docstring and typing hint, this returns a Tag object.
obj, ref = repo.resolve_refish(str(tag_oid))
assert isinstance(obj, Tag)
assert ref is None
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
エントリーポイントの Repository.resolve_refish から始め、シンボリック参照と直接のオブジェクト ID がどのように解決されるかを調べます。Commit、Tag、ref の各ターゲットを対象とする既存のテストを確認し、その後、想定される戻り値の契約をメンテナーと確認します。ドキュメント化および型付けされた動作が検証済みの動作と一致し、2 つの例に対するリグレッションテストのカバレッジがあることが完了の条件です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- git, python
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 55/100