mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
remove useless returned variable
This commit is contained in:
@ -265,7 +265,7 @@ func (c *GitCommand) UsingGpg() bool {
|
|||||||
func (c *GitCommand) Commit(g *gocui.Gui, message string) (*exec.Cmd, error) {
|
func (c *GitCommand) Commit(g *gocui.Gui, message string) (*exec.Cmd, error) {
|
||||||
command := "git commit -m " + c.OSCommand.Quote(message)
|
command := "git commit -m " + c.OSCommand.Quote(message)
|
||||||
if c.UsingGpg() {
|
if c.UsingGpg() {
|
||||||
return c.OSCommand.PrepareSubProcess(c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, command)
|
return c.OSCommand.PrepareSubProcess(c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, command), nil
|
||||||
}
|
}
|
||||||
return nil, c.OSCommand.RunCommand(command)
|
return nil, c.OSCommand.RunCommand(command)
|
||||||
}
|
}
|
||||||
@ -391,12 +391,12 @@ func (c *GitCommand) Checkout(branch string, force bool) error {
|
|||||||
|
|
||||||
// AddPatch prepares a subprocess for adding a patch by patch
|
// AddPatch prepares a subprocess for adding a patch by patch
|
||||||
// this will eventually be swapped out for a better solution inside the Gui
|
// this will eventually be swapped out for a better solution inside the Gui
|
||||||
func (c *GitCommand) AddPatch(filename string) (*exec.Cmd, error) {
|
func (c *GitCommand) AddPatch(filename string) *exec.Cmd {
|
||||||
return c.OSCommand.PrepareSubProcess("git", "add", "--patch", filename)
|
return c.OSCommand.PrepareSubProcess("git", "add", "--patch", filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrepareCommitSubProcess prepares a subprocess for `git commit`
|
// PrepareCommitSubProcess prepares a subprocess for `git commit`
|
||||||
func (c *GitCommand) PrepareCommitSubProcess() (*exec.Cmd, error) {
|
func (c *GitCommand) PrepareCommitSubProcess() *exec.Cmd {
|
||||||
return c.OSCommand.PrepareSubProcess("git", "commit")
|
return c.OSCommand.PrepareSubProcess("git", "commit")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +121,7 @@ func (c *OSCommand) OpenFile(filename string) error {
|
|||||||
// falling back to core.editor, VISUAL, EDITOR, then vi
|
// falling back to core.editor, VISUAL, EDITOR, then vi
|
||||||
func (c *OSCommand) EditFile(filename string) (*exec.Cmd, error) {
|
func (c *OSCommand) EditFile(filename string) (*exec.Cmd, error) {
|
||||||
editor, _ := gitconfig.Global("core.editor")
|
editor, _ := gitconfig.Global("core.editor")
|
||||||
|
|
||||||
if editor == "" {
|
if editor == "" {
|
||||||
editor = os.Getenv("VISUAL")
|
editor = os.Getenv("VISUAL")
|
||||||
}
|
}
|
||||||
@ -135,13 +136,13 @@ func (c *OSCommand) EditFile(filename string) (*exec.Cmd, error) {
|
|||||||
if editor == "" {
|
if editor == "" {
|
||||||
return nil, errors.New("No editor defined in $VISUAL, $EDITOR, or git config")
|
return nil, errors.New("No editor defined in $VISUAL, $EDITOR, or git config")
|
||||||
}
|
}
|
||||||
return c.PrepareSubProcess(editor, filename)
|
|
||||||
|
return c.PrepareSubProcess(editor, filename), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrepareSubProcess iniPrepareSubProcessrocess then tells the Gui to switch to it
|
// PrepareSubProcess iniPrepareSubProcessrocess then tells the Gui to switch to it
|
||||||
func (c *OSCommand) PrepareSubProcess(cmdName string, commandArgs ...string) (*exec.Cmd, error) {
|
func (c *OSCommand) PrepareSubProcess(cmdName string, commandArgs ...string) *exec.Cmd {
|
||||||
subprocess := exec.Command(cmdName, commandArgs...)
|
return exec.Command(cmdName, commandArgs...)
|
||||||
return subprocess, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quote wraps a message in platform-specific quotation marks
|
// Quote wraps a message in platform-specific quotation marks
|
||||||
|
@ -85,11 +85,8 @@ func (gui *Gui) handleAddPatch(g *gocui.Gui, v *gocui.View) error {
|
|||||||
if !file.Tracked {
|
if !file.Tracked {
|
||||||
return gui.createErrorPanel(g, gui.Tr.SLocalize("CannotGitAdd"))
|
return gui.createErrorPanel(g, gui.Tr.SLocalize("CannotGitAdd"))
|
||||||
}
|
}
|
||||||
sub, err := gui.GitCommand.AddPatch(file.Name)
|
|
||||||
if err != nil {
|
gui.SubProcess = gui.GitCommand.AddPatch(file.Name)
|
||||||
return err
|
|
||||||
}
|
|
||||||
gui.SubProcess = sub
|
|
||||||
return gui.Errors.ErrSubProcess
|
return gui.Errors.ErrSubProcess
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,16 +215,11 @@ func (gui *Gui) handleCommitEditorPress(g *gocui.Gui, filesView *gocui.View) err
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PrepareSubProcess - prepare a subprocess for execution and tell the gui to switch to it
|
// PrepareSubProcess - prepare a subprocess for execution and tell the gui to switch to it
|
||||||
func (gui *Gui) PrepareSubProcess(g *gocui.Gui, commands ...string) error {
|
func (gui *Gui) PrepareSubProcess(g *gocui.Gui, commands ...string) {
|
||||||
sub, err := gui.GitCommand.PrepareCommitSubProcess()
|
gui.SubProcess = gui.GitCommand.PrepareCommitSubProcess()
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
gui.SubProcess = sub
|
|
||||||
g.Update(func(g *gocui.Gui) error {
|
g.Update(func(g *gocui.Gui) error {
|
||||||
return gui.Errors.ErrSubProcess
|
return gui.Errors.ErrSubProcess
|
||||||
})
|
})
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) genericFileOpen(g *gocui.Gui, v *gocui.View, filename string, open func(string) (*exec.Cmd, error)) error {
|
func (gui *Gui) genericFileOpen(g *gocui.Gui, v *gocui.View, filename string, open func(string) (*exec.Cmd, error)) error {
|
||||||
|
Reference in New Issue
Block a user