feature: double tap commit with tracked remote branch checks out local tracking branch (#1409)

This commit is contained in:
Nathan Baulch 2025-06-10 17:58:57 +10:00 committed by GitHub
parent ee4d8a6a0e
commit 6c04f5390a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -231,9 +231,24 @@ namespace SourceGit.ViewModels
return;
}
}
else if (d.Type == Models.DecoratorType.RemoteBranchHead && firstRemoteBranch == null)
else if (d.Type == Models.DecoratorType.RemoteBranchHead)
{
firstRemoteBranch = _repo.Branches.Find(x => x.FriendlyName == d.Name);
var remoteBranch = _repo.Branches.Find(x => x.FriendlyName == d.Name);
if (remoteBranch != null)
{
var localBranch = _repo.Branches.Find(x => x.IsLocal && x.Upstream == remoteBranch.FullName);
if (localBranch != null)
{
if (!localBranch.IsCurrent)
_repo.CheckoutBranch(localBranch);
return;
}
}
if (firstRemoteBranch == null)
{
firstRemoteBranch = remoteBranch;
}
}
}