Skip to content

Commit 6c04f53

Browse files
authored
feature: double tap commit with tracked remote branch checks out local tracking branch (#1409)
1 parent ee4d8a6 commit 6c04f53

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/ViewModels/Histories.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,24 @@ public void DoubleTapped(Models.Commit commit)
231231
return;
232232
}
233233
}
234-
else if (d.Type == Models.DecoratorType.RemoteBranchHead && firstRemoteBranch == null)
234+
else if (d.Type == Models.DecoratorType.RemoteBranchHead)
235235
{
236-
firstRemoteBranch = _repo.Branches.Find(x => x.FriendlyName == d.Name);
236+
var remoteBranch = _repo.Branches.Find(x => x.FriendlyName == d.Name);
237+
if (remoteBranch != null)
238+
{
239+
var localBranch = _repo.Branches.Find(x => x.IsLocal && x.Upstream == remoteBranch.FullName);
240+
if (localBranch != null)
241+
{
242+
if (!localBranch.IsCurrent)
243+
_repo.CheckoutBranch(localBranch);
244+
return;
245+
}
246+
}
247+
248+
if (firstRemoteBranch == null)
249+
{
250+
firstRemoteBranch = remoteBranch;
251+
}
237252
}
238253
}
239254

0 commit comments

Comments
 (0)