Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/Files.App/Services/Git/LibGit2Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,15 @@ private static void CheckoutRemoteBranch(Repository repository, Branch branch)
{
var uniqueName = branch.FriendlyName.Substring(END_OF_ORIGIN_PREFIX);

// TODO: This is a temp fix to avoid an issue where Files would create many branches in a loop
if (repository.Branches.Any(b => !b.IsRemote && b.FriendlyName == uniqueName))
{
var localBranch = repository.Branches[uniqueName];
if (repository.Head.FriendlyName != localBranch.FriendlyName)
{
LibGit2Sharp.Commands.Checkout(repository, localBranch);
}
return;
}

//var discriminator = 0;
//while (repository.Branches.Any(b => !b.IsRemote && b.FriendlyName == uniqueName))
Expand Down
8 changes: 7 additions & 1 deletion src/Files.App/Utils/Git/GitHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,15 @@ private static void CheckoutRemoteBranch(Repository repository, Branch branch)
{
var uniqueName = branch.FriendlyName.Substring(END_OF_ORIGIN_PREFIX);

// TODO: This is a temp fix to avoid an issue where Files would create many branches in a loop
if (repository.Branches.Any(b => !b.IsRemote && b.FriendlyName == uniqueName))
{
var localBranch = repository.Branches[uniqueName];
if (repository.Head.FriendlyName != localBranch.FriendlyName)
{
LibGit2Sharp.Commands.Checkout(repository, localBranch);
}
return;
}

//var discriminator = 0;
//while (repository.Branches.Any(b => !b.IsRemote && b.FriendlyName == uniqueName))
Expand Down