CheckoutConflictException on Commands.Checkout
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
Research direction
Start with the reproduced Commands.Checkout call, its CheckoutConflictException handling, and the observed Repo.Index ConflictCollection state on LibGit2Sharp v0.25.2. Compare the checkout notification flags and exception behavior using the supplied Unity example on the stated Windows and .NET environment. Done means explaining the exception and conflict-state behavior, or identifying the required documentation or correction.
Written by the indexing model from the issue text.
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
- Dominant language
- C#
- Stars
- 3.5k
- Forks
- 925
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from libgit2/libgit2sharp
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
libgit2/libgit2sharp#2193 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
libgit2/libgit2sharp#2192 · 1 comment ·
-
Website is down Open
Difficulty 4/5 3-5 days Newbie friendliness 20/100
libgit2/libgit2sharp#2191 · 2 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
libgit2/libgit2sharp#2189 · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
libgit2/libgit2sharp#2187 · 2 comments ·
All issues in libgit2/libgit2sharp
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SubtitleEdit/subtitleedit#15108 · 1 comment ·
-
area/docs-content Bug pulumi/docs
Difficulty 1/5 1-3 hours Newbie friendliness 94/100
-
agentic-workflows untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100