libgit2 / libgit2/libgit2sharp
CheckoutConflictException on Commands.Checkout
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 3.5k
- Fork
- 925
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con la chiamata riprodotta a Commands.Checkout, la relativa gestione di CheckoutConflictException e lo stato osservato di Repo.Index ConflictCollection su LibGit2Sharp v0.25.2. Confronta i flag di notifica del checkout e il comportamento dell'eccezione usando l'esempio Unity fornito nell'ambiente Windows e .NET indicato. Il lavoro è completato quando viene spiegato il comportamento dell'eccezione e dello stato dei conflitti, oppure vengono identificati la documentazione o la correzione necessarie.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp, git
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100