libgit2 / libgit2/libgit2sharp
CheckoutConflictException on Commands.Checkout
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
Hi!
I want to create a UI to make resolving conflicts for a user as easy as possible. At the moment after i have created a conflict by make some changes local and in the repository in the same line of the same file, i want to do first a checkout to get informations about the conflicted file
Reproduction steps
Here is my code to make the checkout of a given Repository:
public void Checkout()
{
try
{
UnityEngine.Debug.Log("starting checkout");
CheckoutOptions opts = new CheckoutOptions();
opts.OnCheckoutNotify = (string path, CheckoutNotifyFlags notify) =>
{
switch (notify)
{
case CheckoutNotifyFlags.Conflict:
UnityEngine.Debug.Log("conflicted file found at: " + path);
return true;
case CheckoutNotifyFlags.Ignored:
UnityEngine.Debug.Log("ignored file found at: " + path);
return true;
case CheckoutNotifyFlags.None:
UnityEngine.Debug.Log("unchanged file found at: " + path);
return true;
case CheckoutNotifyFlags.Untracked:
UnityEngine.Debug.Log("untracked file found at: " + path);
return true;
case CheckoutNotifyFlags.Updated:
UnityEngine.Debug.Log("updated file found at: " + path);
return true;
default:
UnityEngine.Debug.Log("dirty file at: " + path);
return true;
}
};
opts.CheckoutNotifyFlags = CheckoutNotifyFlags.None |
CheckoutNotifyFlags.Dirty |
CheckoutNotifyFlags.Ignored |
CheckoutNotifyFlags.Conflict |
CheckoutNotifyFlags.Untracked |
CheckoutNotifyFlags.Updated;
Branch actualRemote = Repo.Branches["origin/" + Repo.Head.FriendlyName];
Commands.Checkout(Repo, actualRemote.Tip.Tree, opts, "");
}
catch (CheckoutConflictException e)
{
UnityEngine.Debug.Log(e.Message);
}
}
Repo is the actual Repository, and it contains in my test example 1 conflicted file.
Expected behavior
I don't find any detailed guide, how to resolve conflicts with LibGit2Sharp, but if i understand it right, the checkout command should write the conflicted files in the ConflictCollection of the index of the repository.
Actual behavior
If i do the checkout with the code above, the conflicted file(s) will be found, but the catch-clause will be triggered and the ConflictCollection of Repo.Index will be still empty. Can somebody explain how this whole process works, how i can use it right and why the exception in the code will be triggered?
Version of LibGit2Sharp (release number or SHA1)
LibGit2Sharp v0.25.2
Operating system(s) tested; .NET runtime tested
Win 10 64bit, .NET Framework 4.6.1
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par l'appel reproduit à Commands.Checkout, sa gestion de CheckoutConflictException et l'état observé de Repo.Index ConflictCollection avec LibGit2Sharp v0.25.2. Comparez les indicateurs de notification du checkout et le comportement de l'exception à l'aide de l'exemple Unity fourni dans l'environnement Windows et .NET indiqué. Le travail est terminé lorsque le comportement de l'exception et de l'état des conflits est expliqué, ou que la documentation ou la correction requise est identifiée.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- csharp, git
- Domaine
- devtools
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100