diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 61b33a9b..9ec3a897 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -142,6 +142,28 @@ namespace SourceGit.ViewModels } } + public void DoubleTapped(Models.Commit commit) + { + if (commit == null || commit.IsCurrentHead) + return; + + foreach (var d in commit.Decorators) + { + if (d.Type == Models.DecoratorType.LocalBranchHead) + { + var b = _repo.Branches.Find(x => x.FriendlyName == d.Name); + if (b != null) + { + _repo.CheckoutBranch(b); + return; + } + } + } + + if (PopupHost.CanCreatePopup()) + PopupHost.ShowPopup(new CheckoutCommit(_repo, commit)); + } + public ContextMenu MakeContextMenu(DataGrid datagrid) { if (datagrid.SelectedItems.Count != 1) diff --git a/src/Views/Histories.axaml b/src/Views/Histories.axaml index f04cdb02..63d4da95 100644 --- a/src/Views/Histories.axaml +++ b/src/Views/Histories.axaml @@ -29,7 +29,8 @@ VerticalScrollBarVisibility="Auto" LayoutUpdated="OnCommitDataGridLayoutUpdated" SelectionChanged="OnCommitDataGridSelectionChanged" - ContextRequested="OnCommitDataGridContextRequested"> + ContextRequested="OnCommitDataGridContextRequested" + DoubleTapped="OnCommitDataGridDoubleTapped">