feature: asking to create local branch instead of checkout commit if some remote branch's HEAD is selected commit (#295)

This commit is contained in:
leo 2024-08-01 16:59:39 +08:00
parent 57e9c44754
commit 7891b1124e
No known key found for this signature in database

View file

@ -147,6 +147,7 @@ namespace SourceGit.ViewModels
if (commit == null || commit.IsCurrentHead)
return;
var firstRemoteBranch = null as Models.Branch;
foreach (var d in commit.Decorators)
{
if (d.Type == Models.DecoratorType.LocalBranchHead)
@ -158,10 +159,19 @@ namespace SourceGit.ViewModels
return;
}
}
else if (d.Type == Models.DecoratorType.RemoteBranchHead && firstRemoteBranch == null)
{
firstRemoteBranch = _repo.Branches.Find(x => x.FriendlyName == d.Name);
}
}
if (PopupHost.CanCreatePopup())
PopupHost.ShowPopup(new CheckoutCommit(_repo, commit));
{
if (firstRemoteBranch != null)
PopupHost.ShowPopup(new CreateBranch(_repo, firstRemoteBranch));
else
PopupHost.ShowPopup(new CheckoutCommit(_repo, commit));
}
}
public ContextMenu MakeContextMenu(DataGrid datagrid)