libgit2 / libgit2/libgit2sharp

Exception: "An item with the same key has already been added" when comparing commits

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

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

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

説明

I get ArgumentException when comparing two commits from https://github.com/shageman/the_next_big_thing with v.0.23.1.0

 System.ArgumentException:`  An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at LibGit2Sharp.Patch.AddFileChange(git_diff_delta* delta) in c:\Git\LibGit2Sharp-2\LibGit2Sharp\Patch.cs:line 54
   at LibGit2Sharp.Patch..ctor(DiffHandle diff) in c:\Git\LibGit2Sharp-2\LibGit2Sharp\Patch.cs:line 43
   at LibGit2Sharp.Diff.<.cctor>b__1b(DiffHandle diff) in c:\Git\LibGit2Sharp-2\LibGit2Sharp\Diff.cs:line 104
   at LibGit2Sharp.Diff.BuildDiffResult[T](DiffHandle diff) in c:\Git\LibGit2Sharp-2\LibGit2Sharp\Diff.cs:line 120
   at LibGit2Sharp.Diff.Compare[T](Tree oldTree, Tree newTree, IEnumerable`1 paths, ExplicitPathsOptions explicitPathsOptions, CompareOptions compareOptions) in c:\Git\LibGit2Sharp-2\LibGit2Sharp\Diff.cs:line 253
   at LibGit2Sharp.Diff.Compare[T](Tree oldTree, Tree newTree) in c:\Git\LibGit2Sharp-2\LibGit2Sharp\Diff.cs:line 157

The code I'am using:
this.repository.Diff.Compare<Patch>(commitB.Tree, commitA.Tree);

commitA: a9a82df96ab1f73c69b2668b91eda31e672bbf98 Move rails application back to root to make heroku deployment work again
commitB: ede0b0c359d5af516889563bebafd51b7f43115a Gemnasium doesn't recognize Gemfile when its not in the root. Let's try symlinks

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

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

はじめの一歩

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

調査の方向性

LibGit2Sharp/Patch.cs の AddFileChange から始め、Diff.Compare 中の Diff.cs からの呼び出し経路を確認します。コミット a9a82df96ab1f73c69b2668b91eda31e672bbf98 と ede0b0c359d5af516889563bebafd51b7f43115a を使って比較を再現します。この比較で重複キーの ArgumentException がスローされなくなり、期待される patch の変更が返されれば完了です。

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

評価

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

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

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