libgit2 / libgit2/libgit2sharp

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

Offen
#1,418 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
C#
Sterne
3.5k
Forks
925
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit LibGit2Sharp/Patch.cs bei AddFileChange und überprüfe den Aufrufpfad von Diff.cs während Diff.Compare. Reproduziere den Vergleich mit den Commits a9a82df96ab1f73c69b2668b91eda31e672bbf98 und ede0b0c359d5af516889563bebafd51b7f43115a. Erledigt ist die Aufgabe, wenn dieser Vergleich nicht mehr die ArgumentException wegen doppelter Schlüssel auslöst und die erwarteten Patch-Änderungen zurückgibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp, git
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.