libgit2 / libgit2/libgit2sharp

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

Ouverte
#1,418 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
C#
Étoiles
3.5k
Forks
925
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par LibGit2Sharp/Patch.cs au niveau de AddFileChange et examinez le chemin d’appel depuis Diff.cs pendant Diff.Compare. Reproduisez la comparaison à l’aide des commits a9a82df96ab1f73c69b2668b91eda31e672bbf98 et ede0b0c359d5af516889563bebafd51b7f43115a. La tâche est terminée lorsque cette comparaison ne lève plus l’ArgumentException liée à une clé en double et renvoie les modifications attendues du patch.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp, git
Domaine
backend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.