Repository.merge_file_from_index - can't take a None as an argument
オープン
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 1.7k
- フォーク
- 408
- 平均マージ
- 2日 57分
- マージ済み PR(30日)
- 7
説明
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?
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
pygit2/repository.py の 682 行付近を読み、Repository.merge_file_from_index 用に示されているテストを実行してください。シグネチャが示しているとおり、実装が theirs 引数に None を受け入れるか確認してください。削除されたファイルの場合に、動作とテストが一致すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- git, python
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100