diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-28 16:28:35 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-29 11:37:29 +1100 |
commit | 624ae45ebb3f54499a25c4eba0844fa971277c34 (patch) | |
tree | ca20f93742858b2b4231d083e5b6abdab61d69ba /pkg/gui/branches_panel.go | |
parent | 2756b82f5733c2099c43279ebb1a962101411142 (diff) |
allow scoped mode where the commits/reflog/stash panels are scoped to a file
WIP
restrict certain actions in scoped mode
WIP
Diffstat (limited to 'pkg/gui/branches_panel.go')
-rw-r--r-- | pkg/gui/branches_panel.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 9f3bd0f97..3d1692844 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -263,6 +263,10 @@ func (gui *Gui) deleteNamedBranch(g *gocui.Gui, v *gocui.View, selectedBranch *c } func (gui *Gui) mergeBranchIntoCheckedOutBranch(branchName string) error { + if ok, err := gui.validateNotInScopedMode(); err != nil || !ok { + return err + } + if gui.GitCommand.IsHeadDetached() { return gui.createErrorPanel("Cannot merge branch in detached head state. You might have checked out a commit directly or a remote branch, in which case you should checkout the local branch you want to be on") } @@ -286,6 +290,10 @@ func (gui *Gui) mergeBranchIntoCheckedOutBranch(branchName string) error { } func (gui *Gui) handleMerge(g *gocui.Gui, v *gocui.View) error { + if ok, err := gui.validateNotInScopedMode(); err != nil || !ok { + return err + } + selectedBranchName := gui.getSelectedBranch().Name return gui.mergeBranchIntoCheckedOutBranch(selectedBranchName) } @@ -296,6 +304,10 @@ func (gui *Gui) handleRebaseOntoLocalBranch(g *gocui.Gui, v *gocui.View) error { } func (gui *Gui) handleRebaseOntoBranch(selectedBranchName string) error { + if ok, err := gui.validateNotInScopedMode(); err != nil || !ok { + return err + } + checkedOutBranch := gui.getCheckedOutBranch().Name if selectedBranchName == checkedOutBranch { return gui.createErrorPanel(gui.Tr.SLocalize("CantRebaseOntoSelf")) |