1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-26 09:00:57 +02:00

s/escape/quit

This commit is contained in:
Tommy Nguyen 2018-08-21 08:54:51 -04:00
parent 646c205227
commit cd4063c763
No known key found for this signature in database
GPG Key ID: DB7FA8161647D196
4 changed files with 18 additions and 17 deletions

View File

@ -270,12 +270,12 @@ func (c *GitCommand) Pull() error {
}
// Push push to a branch
func (c *GitCommand) Push(branchName string, force bool) error {
func (c *GitCommand) Push(branchName string, force bool) (*exec.Cmd, error) {
forceFlag := ""
if force {
forceFlag = "--force-with-lease "
}
return c.OSCommand.RunCommand("git push " + forceFlag + "-u origin " + branchName)
return c.OSCommand.PrepareSubProcess(c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, "git push " + forceFlag + "-u origin " + branchName)
}
// SquashPreviousTwoCommits squashes a commit down to the one below it

View File

@ -364,17 +364,18 @@ func (gui *Gui) pushWithForceFlag(currentView *gocui.View, force bool) error {
if err := gui.createMessagePanel(gui.g, currentView, "", gui.Tr.SLocalize("PushWait")); err != nil {
return err
}
go func() {
branchName := gui.State.Branches[0].Name
if err := gui.GitCommand.Push(branchName, force); err != nil {
_ = gui.createErrorPanel(gui.g, err.Error())
} else {
_ = gui.closeConfirmationPrompt(gui.g)
_ = gui.refreshCommits(gui.g)
_ = gui.refreshStatus(gui.g)
}
}()
return nil
branchName := gui.State.Branches[0].Name
sub, err := gui.GitCommand.Push(branchName, force)
if err != nil {
_ = gui.createErrorPanel(gui.g, err.Error())
}
if sub != nil {
gui.SubProcess = sub
return gui.Errors.ErrSubProcess
}
_ = gui.closeConfirmationPrompt(gui.g)
_ = gui.refreshStatus(gui.g)
return gui.refreshCommits(gui.g)
}
func (gui *Gui) pushFiles(g *gocui.Gui, v *gocui.View) error {

View File

@ -362,6 +362,6 @@ func (gui *Gui) RunWithSubprocesses() {
}
}
func (gui *Gui) escape(g *gocui.Gui, v *gocui.View) error {
func (gui *Gui) quit(g *gocui.Gui, v *gocui.View) error {
return gocui.ErrQuit
}

View File

@ -14,9 +14,9 @@ type Binding struct {
func (gui *Gui) keybindings(g *gocui.Gui) error {
bindings := []Binding{
{ViewName: "", Key: 'q', Modifier: gocui.ModNone, Handler: gui.escape},
{ViewName: "", Key: gocui.KeyCtrlC, Modifier: gocui.ModNone, Handler: gui.escape},
{ViewName: "", Key: gocui.KeyEsc, Modifier: gocui.ModNone, Handler: gui.escape},
{ViewName: "", Key: 'q', Modifier: gocui.ModNone, Handler: gui.quit},
{ViewName: "", Key: gocui.KeyCtrlC, Modifier: gocui.ModNone, Handler: gui.quit},
{ViewName: "", Key: gocui.KeyEsc, Modifier: gocui.ModNone, Handler: gui.quit},
{ViewName: "", Key: gocui.KeyPgup, Modifier: gocui.ModNone, Handler: gui.scrollUpMain},
{ViewName: "", Key: gocui.KeyPgdn, Modifier: gocui.ModNone, Handler: gui.scrollDownMain},
{ViewName: "", Key: gocui.KeyCtrlU, Modifier: gocui.ModNone, Handler: gui.scrollUpMain},