libgit2 / libgit2/libgit2sharp
CheckoutConflictException on Commands.Checkout
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- C#
- Estrellas
- 3.5k
- Forks
- 925
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con la llamada reproducida a Commands.Checkout, su gestión de CheckoutConflictException y el estado observado de Repo.Index ConflictCollection en LibGit2Sharp v0.25.2. Compara los flags de notificación de checkout y el comportamiento de la excepción usando el ejemplo de Unity proporcionado en el entorno de Windows y .NET indicado. El trabajo estará terminado cuando se explique el comportamiento de la excepción y del estado de conflictos, o se identifique la documentación o corrección necesaria.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- csharp, git
- Área
- devtools
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100