Skip to content

Commit 7891b11

Browse files
committed
feature: asking to create local branch instead of checkout commit if some remote branch's HEAD is selected commit (sourcegit-scm#295)
1 parent 57e9c44 commit 7891b11

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/ViewModels/Histories.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ public void DoubleTapped(Models.Commit commit)
147147
if (commit == null || commit.IsCurrentHead)
148148
return;
149149

150+
var firstRemoteBranch = null as Models.Branch;
150151
foreach (var d in commit.Decorators)
151152
{
152153
if (d.Type == Models.DecoratorType.LocalBranchHead)
@@ -158,10 +159,19 @@ public void DoubleTapped(Models.Commit commit)
158159
return;
159160
}
160161
}
162+
else if (d.Type == Models.DecoratorType.RemoteBranchHead && firstRemoteBranch == null)
163+
{
164+
firstRemoteBranch = _repo.Branches.Find(x => x.FriendlyName == d.Name);
165+
}
161166
}
162167

163168
if (PopupHost.CanCreatePopup())
164-
PopupHost.ShowPopup(new CheckoutCommit(_repo, commit));
169+
{
170+
if (firstRemoteBranch != null)
171+
PopupHost.ShowPopup(new CreateBranch(_repo, firstRemoteBranch));
172+
else
173+
PopupHost.ShowPopup(new CheckoutCommit(_repo, commit));
174+
}
165175
}
166176

167177
public ContextMenu MakeContextMenu(DataGrid datagrid)

0 commit comments

Comments
 (0)