mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-24 05:36:19 +02:00
rename to make way for a generic function name
This commit is contained in:
parent
26f80087dd
commit
f858c8e750
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
// list panel functions
|
// list panel functions
|
||||||
|
|
||||||
func (gui *Gui) getSelectedCommit() *commands.Commit {
|
func (gui *Gui) getSelectedLocalCommit() *commands.Commit {
|
||||||
selectedLine := gui.State.Panels.Commits.SelectedLineIdx
|
selectedLine := gui.State.Panels.Commits.SelectedLineIdx
|
||||||
if selectedLine == -1 {
|
if selectedLine == -1 {
|
||||||
return nil
|
return nil
|
||||||
@ -33,7 +33,7 @@ func (gui *Gui) handleCommitSelect() error {
|
|||||||
gui.handleEscapeLineByLinePanel()
|
gui.handleEscapeLineByLinePanel()
|
||||||
|
|
||||||
var task updateTask
|
var task updateTask
|
||||||
commit := gui.getSelectedCommit()
|
commit := gui.getSelectedLocalCommit()
|
||||||
if commit == nil {
|
if commit == nil {
|
||||||
task = gui.createRenderStringTask(gui.Tr.SLocalize("NoCommitsThisBranch"))
|
task = gui.createRenderStringTask(gui.Tr.SLocalize("NoCommitsThisBranch"))
|
||||||
} else {
|
} else {
|
||||||
@ -197,7 +197,7 @@ func (gui *Gui) handleRenameCommit(g *gocui.Gui, v *gocui.View) error {
|
|||||||
return gui.createErrorPanel(gui.Tr.SLocalize("OnlyRenameTopCommit"))
|
return gui.createErrorPanel(gui.Tr.SLocalize("OnlyRenameTopCommit"))
|
||||||
}
|
}
|
||||||
|
|
||||||
commit := gui.getSelectedCommit()
|
commit := gui.getSelectedLocalCommit()
|
||||||
if commit == nil {
|
if commit == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -504,7 +504,7 @@ func (gui *Gui) HandlePasteCommits(g *gocui.Gui, v *gocui.View) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleViewCommitFiles() error {
|
func (gui *Gui) handleViewCommitFiles() error {
|
||||||
commit := gui.getSelectedCommit()
|
commit := gui.getSelectedLocalCommit()
|
||||||
if commit == nil {
|
if commit == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -530,7 +530,7 @@ func (gui *Gui) handleCreateFixupCommit(g *gocui.Gui, v *gocui.View) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
commit := gui.getSelectedCommit()
|
commit := gui.getSelectedLocalCommit()
|
||||||
if commit == nil {
|
if commit == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -560,7 +560,7 @@ func (gui *Gui) handleSquashAllAboveFixupCommits(g *gocui.Gui, v *gocui.View) er
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
commit := gui.getSelectedCommit()
|
commit := gui.getSelectedLocalCommit()
|
||||||
if commit == nil {
|
if commit == nil {
|
||||||
return 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
|
// 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
|
// if annotated, switch to a subprocess to create the message
|
||||||
|
|
||||||
commit := gui.getSelectedCommit()
|
commit := gui.getSelectedLocalCommit()
|
||||||
if commit == nil {
|
if commit == nil {
|
||||||
return 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 {
|
func (gui *Gui) handleCheckoutCommit(g *gocui.Gui, v *gocui.View) error {
|
||||||
commit := gui.getSelectedCommit()
|
commit := gui.getSelectedLocalCommit()
|
||||||
if commit == nil {
|
if commit == nil {
|
||||||
return 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 {
|
func (gui *Gui) handleCreateCommitResetMenu(g *gocui.Gui, v *gocui.View) error {
|
||||||
commit := gui.getSelectedCommit()
|
commit := gui.getSelectedLocalCommit()
|
||||||
if commit == nil {
|
if commit == nil {
|
||||||
return gui.createErrorPanel(gui.Tr.SLocalize("NoCommitsThisBranch"))
|
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 {
|
func (gui *Gui) handleClipboardCopyCommit(g *gocui.Gui, v *gocui.View) error {
|
||||||
commit := gui.getSelectedCommit()
|
commit := gui.getSelectedLocalCommit()
|
||||||
if commit == nil {
|
if commit == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -676,7 +676,7 @@ func (gui *Gui) handleClipboardCopyCommit(g *gocui.Gui, v *gocui.View) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleNewBranchOffCommit() error {
|
func (gui *Gui) handleNewBranchOffCommit() error {
|
||||||
commit := gui.getSelectedCommit()
|
commit := gui.getSelectedLocalCommit()
|
||||||
if commit == nil {
|
if commit == nil {
|
||||||
return 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 {
|
if err := gui.GitCommand.NewBranch(response, commit.Sha); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ func (gui *Gui) currentDiffTerminals() []string {
|
|||||||
case COMMIT_FILES_CONTEXT_KEY:
|
case COMMIT_FILES_CONTEXT_KEY:
|
||||||
// not supporting commit files for now
|
// not supporting commit files for now
|
||||||
case BRANCH_COMMITS_CONTEXT_KEY:
|
case BRANCH_COMMITS_CONTEXT_KEY:
|
||||||
item := gui.getSelectedCommit()
|
item := gui.getSelectedLocalCommit()
|
||||||
if item != nil {
|
if item != nil {
|
||||||
return []string{item.RefName()}
|
return []string{item.RefName()}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
return presentation.GetCommitListDisplayStrings(gui.State.Commits, gui.State.ScreenMode != SCREEN_NORMAL, gui.cherryPickedCommitShaMap(), gui.State.Diff.Ref)
|
||||||
},
|
},
|
||||||
Contains: CONTAINS_FILES,
|
Contains: CONTAINS_FILES,
|
||||||
GetSelectedItem: func() ListItem { return gui.getSelectedCommit() },
|
GetSelectedItem: func() ListItem { return gui.getSelectedLocalCommit() },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ func (gui *Gui) handleCreatePatchOptionsMenu(g *gocui.Gui, v *gocui.View) error
|
|||||||
}...)
|
}...)
|
||||||
|
|
||||||
if gui.currentContext() == gui.Contexts.BranchCommits.Context {
|
if gui.currentContext() == gui.Contexts.BranchCommits.Context {
|
||||||
selectedCommit := gui.getSelectedCommit()
|
selectedCommit := gui.getSelectedLocalCommit()
|
||||||
if selectedCommit != nil && gui.GitCommand.PatchManager.Parent != selectedCommit.Sha {
|
if selectedCommit != nil && gui.GitCommand.PatchManager.Parent != selectedCommit.Sha {
|
||||||
// adding this option to index 1
|
// adding this option to index 1
|
||||||
menuItems = append(
|
menuItems = append(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user