mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2025-01-23 01:36:57 -08:00
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:
parent
57e9c44754
commit
7891b1124e
1 changed files with 11 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue