libgit2 / libgit2/libgit2

`git_diff_from_buffer` fails to parse a diff file containing an empty file

オープン
#5,713 コメント 0 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C
スター
10.6k
フォーク
2.7k
PR マージ指標
30日以内にマージされた PR はありません

説明

Reproduction steps:
Calling git_diff_from_buffer when the diff file contains deletion/creation of an empty file.
Call git_diff_from_buffer with the following diff file:

diff --git a/patchFolder/deleteFile.txt b/patchFolder/deleteFile.txt
deleted file mode 100644
index e69de29..0000000
diff --git a/patchFolder/modifyFile.txt b/patchFolder/modifyFile.txt
index ce01362..14be0d4 100644
--- a/patchFolder/modifyFile.txt
+++ b/patchFolder/modifyFile.txt
@@ -1 +1 @@
-hello
+hello2

Same happens with:

diff --git a/emptyfile2 b/emptyfile2
new file mode 100644
index 0000000..e69de29

Expected behavior:
Proper git_diff object. Command line version of git has no problem with the diff file.
Actual behavior:
Error code -1, git_diff null.

Version of libgit2 (release number or SHA1)
1.1.0-1
Operating system(s) tested
Arch linux

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず git_diff_from_buffer エントリーポイントを見つけ、空のファイルに対して提供された削除および作成の diff を再現します。結果を空でないファイルの diff の動作と比較します。完了条件は、空のファイルに関する両方のケースが、エラーコード -1 と null ではなく、適切な git_diff オブジェクトを返すことです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, git
領域
devtools
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。