From 0bddcfe24e969a66f2321118c0e1ed2bd0259319 Mon Sep 17 00:00:00 2001 From: Nathan Baulch Date: Tue, 10 Jun 2025 17:18:46 +1000 Subject: [PATCH] feature: double tap commit with tracked remote branch checks out local tracking branch --- src/ViewModels/Histories.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 6b2208f9..044d436e 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -231,9 +231,24 @@ public void DoubleTapped(Models.Commit commit) 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; + } } }