libgit2 / libgit2/libgit2sharp
Getting patch with unicode characters confuses git apply
オープン
まだ誰も着手していません。
- 主要言語
- C#
- スター
- 3.5k
- フォーク
- 925
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
var patches = repo0.Diff.Compare<Patch>(commit1?.Tree, commit2.Tree, Enumerable.Repeat(change.Path, 1), compareOptions: compareOptions);
Getting patches + applying them to file does not seems to work if there are unicode characters in file itself.
Have tried to save it in utf8, but problem still persists.
As a walkaround to this problem, I have added extra comparison that there aren't any unicode characters.
// If we have some unicode characters, then cannot be handled as text diff.
canBeHandledAsTextPatch = strpatches.All(c => c <= 255);
But, libgit itself has built in support for patching, See https://libgit2.org/libgit2/#HEAD, git_apply* function calls - but none of these operations seems to be supported in libgit2sharp.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、Diff.Compare と既存のテキストパッチ処理を通じて Unicode の不具合を再現し、次に issue で参照されている libgit2 の git_apply* API を確認します。Unicode 文字を含むファイルのパッチを、説明されている workaround なしで正しく取得して適用できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp, git
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 32/100