mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-17 08:24:59 +00:00
feature: when trying to checkout a local branch from its tracking upstream and it is behind the upstream, show Checkout & Fast-Forward
popup
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
6c04f5390a
commit
7d0536d94b
8 changed files with 203 additions and 6 deletions
|
@ -236,11 +236,13 @@ namespace SourceGit.ViewModels
|
|||
var remoteBranch = _repo.Branches.Find(x => x.FriendlyName == d.Name);
|
||||
if (remoteBranch != null)
|
||||
{
|
||||
// If there's a local branch that is tracking on this remote branch and it does not ahead of
|
||||
// its upstream, show `Create and Fast-Forward` popup.
|
||||
var localBranch = _repo.Branches.Find(x => x.IsLocal && x.Upstream == remoteBranch.FullName);
|
||||
if (localBranch != null)
|
||||
if (localBranch is { TrackStatus: { Ahead: { Count: 0 } } })
|
||||
{
|
||||
if (!localBranch.IsCurrent)
|
||||
_repo.CheckoutBranch(localBranch);
|
||||
if (_repo.CanCreatePopup())
|
||||
_repo.ShowPopup(new CheckoutAndFastForward(_repo, localBranch, remoteBranch));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue