diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-01-07 20:24:10 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-01-07 20:43:01 +1100 |
commit | 09aabce3cd38312e854fdbb29046acba42a67f38 (patch) | |
tree | bb80f85919cd375f0f8829438896dde73a119725 /pkg/gui/commits_panel.go | |
parent | eb2bfd3848bc5178670380f77b675a27d94d2515 (diff) |
allow commits to be checked out
Diffstat (limited to 'pkg/gui/commits_panel.go')
-rw-r--r-- | pkg/gui/commits_panel.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index 22ea6fe7e..3f82584c1 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -611,3 +611,14 @@ func (gui *Gui) handleCreateLightweightTag(commitSha string) error { return gui.handleCommitSelect(g, v) }) } + +func (gui *Gui) handleCheckoutCommit(g *gocui.Gui, v *gocui.View) error { + commit := gui.getSelectedCommit(g) + if commit == nil { + return gui.renderString(g, "main", gui.Tr.SLocalize("NoCommitsThisBranch")) + } + + return gui.createConfirmationPanel(g, gui.getCommitsView(), true, gui.Tr.SLocalize("checkoutCommit"), gui.Tr.SLocalize("SureCheckoutThisCommit"), func(g *gocui.Gui, v *gocui.View) error { + return gui.handleCheckoutRef(commit.Sha) + }, nil) +} |