From f858c8e7509526b2e174e9aa83c54a4aea146b38 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 22 Aug 2020 09:48:20 +1000 Subject: [PATCH] rename to make way for a generic function name --- pkg/gui/commits_panel.go | 24 ++++++++++++------------ pkg/gui/diffing.go | 2 +- pkg/gui/list_context.go | 2 +- pkg/gui/patch_options_panel.go | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index 3663112ee..db3aea4df 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -10,7 +10,7 @@ import ( // list panel functions -func (gui *Gui) getSelectedCommit() *commands.Commit { +func (gui *Gui) getSelectedLocalCommit() *commands.Commit { selectedLine := gui.State.Panels.Commits.SelectedLineIdx if selectedLine == -1 { return nil @@ -33,7 +33,7 @@ func (gui *Gui) handleCommitSelect() error { gui.handleEscapeLineByLinePanel() var task updateTask - commit := gui.getSelectedCommit() + commit := gui.getSelectedLocalCommit() if commit == nil { task = gui.createRenderStringTask(gui.Tr.SLocalize("NoCommitsThisBranch")) } else { @@ -197,7 +197,7 @@ func (gui *Gui) handleRenameCommit(g *gocui.Gui, v *gocui.View) error { return gui.createErrorPanel(gui.Tr.SLocalize("OnlyRenameTopCommit")) } - commit := gui.getSelectedCommit() + commit := gui.getSelectedLocalCommit() if commit == nil { return nil } @@ -504,7 +504,7 @@ func (gui *Gui) HandlePasteCommits(g *gocui.Gui, v *gocui.View) error { } func (gui *Gui) handleViewCommitFiles() error { - commit := gui.getSelectedCommit() + commit := gui.getSelectedLocalCommit() if commit == nil { return nil } @@ -530,7 +530,7 @@ func (gui *Gui) handleCreateFixupCommit(g *gocui.Gui, v *gocui.View) error { return err } - commit := gui.getSelectedCommit() + commit := gui.getSelectedLocalCommit() if commit == nil { return nil } @@ -560,7 +560,7 @@ func (gui *Gui) handleSquashAllAboveFixupCommits(g *gocui.Gui, v *gocui.View) er return err } - commit := gui.getSelectedCommit() + commit := gui.getSelectedLocalCommit() if commit == nil { return nil } @@ -588,7 +588,7 @@ func (gui *Gui) handleTagCommit(g *gocui.Gui, v *gocui.View) error { // TODO: bring up menu asking if you want to make a lightweight or annotated tag // if annotated, switch to a subprocess to create the message - commit := gui.getSelectedCommit() + commit := gui.getSelectedLocalCommit() if commit == nil { return nil } @@ -606,7 +606,7 @@ func (gui *Gui) handleCreateLightweightTag(commitSha string) error { } func (gui *Gui) handleCheckoutCommit(g *gocui.Gui, v *gocui.View) error { - commit := gui.getSelectedCommit() + commit := gui.getSelectedLocalCommit() if commit == nil { return nil } @@ -623,7 +623,7 @@ func (gui *Gui) handleCheckoutCommit(g *gocui.Gui, v *gocui.View) error { } func (gui *Gui) handleCreateCommitResetMenu(g *gocui.Gui, v *gocui.View) error { - commit := gui.getSelectedCommit() + commit := gui.getSelectedLocalCommit() if commit == nil { return gui.createErrorPanel(gui.Tr.SLocalize("NoCommitsThisBranch")) } @@ -667,7 +667,7 @@ func (gui *Gui) handleGotoBottomForCommitsPanel(g *gocui.Gui, v *gocui.View) err } func (gui *Gui) handleClipboardCopyCommit(g *gocui.Gui, v *gocui.View) error { - commit := gui.getSelectedCommit() + commit := gui.getSelectedLocalCommit() if commit == nil { return nil } @@ -676,7 +676,7 @@ func (gui *Gui) handleClipboardCopyCommit(g *gocui.Gui, v *gocui.View) error { } func (gui *Gui) handleNewBranchOffCommit() error { - commit := gui.getSelectedCommit() + commit := gui.getSelectedLocalCommit() if commit == nil { return nil } @@ -688,7 +688,7 @@ func (gui *Gui) handleNewBranchOffCommit() error { }, ) - return gui.prompt(gui.getCommitsView(), message, "", func(response string) error { + return gui.prompt(gui.getCurrentSideView(), message, "", func(response string) error { if err := gui.GitCommand.NewBranch(response, commit.Sha); err != nil { return err } diff --git a/pkg/gui/diffing.go b/pkg/gui/diffing.go index bb143b2a7..85b6f2e6b 100644 --- a/pkg/gui/diffing.go +++ b/pkg/gui/diffing.go @@ -47,7 +47,7 @@ func (gui *Gui) currentDiffTerminals() []string { case COMMIT_FILES_CONTEXT_KEY: // not supporting commit files for now case BRANCH_COMMITS_CONTEXT_KEY: - item := gui.getSelectedCommit() + item := gui.getSelectedLocalCommit() if item != nil { return []string{item.RefName()} } diff --git a/pkg/gui/list_context.go b/pkg/gui/list_context.go index 344cee86b..1edaf410f 100644 --- a/pkg/gui/list_context.go +++ b/pkg/gui/list_context.go @@ -362,7 +362,7 @@ func (gui *Gui) branchCommitsListContext() *ListContext { return presentation.GetCommitListDisplayStrings(gui.State.Commits, gui.State.ScreenMode != SCREEN_NORMAL, gui.cherryPickedCommitShaMap(), gui.State.Diff.Ref) }, Contains: CONTAINS_FILES, - GetSelectedItem: func() ListItem { return gui.getSelectedCommit() }, + GetSelectedItem: func() ListItem { return gui.getSelectedLocalCommit() }, } } diff --git a/pkg/gui/patch_options_panel.go b/pkg/gui/patch_options_panel.go index 098e0db4d..4cee188f3 100644 --- a/pkg/gui/patch_options_panel.go +++ b/pkg/gui/patch_options_panel.go @@ -43,7 +43,7 @@ func (gui *Gui) handleCreatePatchOptionsMenu(g *gocui.Gui, v *gocui.View) error }...) if gui.currentContext() == gui.Contexts.BranchCommits.Context { - selectedCommit := gui.getSelectedCommit() + selectedCommit := gui.getSelectedLocalCommit() if selectedCommit != nil && gui.GitCommand.PatchManager.Parent != selectedCommit.Sha { // adding this option to index 1 menuItems = append(