mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-04 10:34:55 +02:00
minor refactor
This commit is contained in:
parent
8ff74072f8
commit
f49e4946f2
@ -131,10 +131,7 @@ func (gui *Gui) handleGitFetch(g *gocui.Gui, v *gocui.View) error {
|
||||
go func() {
|
||||
err := gui.fetch(true)
|
||||
gui.HandleCredentialsPopup(err)
|
||||
if err == nil {
|
||||
_ = gui.closeConfirmationPrompt(gui.g, true)
|
||||
_ = gui.refreshSidePanels(refreshOptions{mode: ASYNC})
|
||||
}
|
||||
_ = gui.refreshSidePanels(refreshOptions{mode: ASYNC})
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
|
@ -86,5 +86,7 @@ func (gui *Gui) HandleCredentialsPopup(cmdErr error) {
|
||||
}
|
||||
// we are not logging this error because it may contain a password
|
||||
_ = gui.createSpecificErrorPanel(errMessage, gui.getFilesView(), false)
|
||||
} else {
|
||||
_ = gui.closeConfirmationPrompt(gui.g, true)
|
||||
}
|
||||
}
|
||||
|
@ -487,20 +487,23 @@ func (gui *Gui) pullFiles(opts PullFilesOptions) error {
|
||||
},
|
||||
)
|
||||
gui.HandleCredentialsPopup(err)
|
||||
if err == nil {
|
||||
switch strategy {
|
||||
case "rebase":
|
||||
err := gui.GitCommand.RebaseBranch("FETCH_HEAD")
|
||||
_ = gui.handleGenericMergeCommandResult(err)
|
||||
case "merge":
|
||||
err := gui.GitCommand.Merge("FETCH_HEAD", commands.MergeOpts{})
|
||||
_ = gui.handleGenericMergeCommandResult(err)
|
||||
case "ff-only":
|
||||
err := gui.GitCommand.Merge("FETCH_HEAD", commands.MergeOpts{FastForwardOnly: true})
|
||||
_ = gui.handleGenericMergeCommandResult(err)
|
||||
default:
|
||||
_ = gui.createErrorPanel(fmt.Sprintf("git pull strategy '%s' unrecognised", strategy))
|
||||
}
|
||||
if err != nil {
|
||||
_ = gui.refreshSidePanels(refreshOptions{mode: ASYNC})
|
||||
return
|
||||
}
|
||||
|
||||
switch strategy {
|
||||
case "rebase":
|
||||
err := gui.GitCommand.RebaseBranch("FETCH_HEAD")
|
||||
_ = gui.handleGenericMergeCommandResult(err)
|
||||
case "merge":
|
||||
err := gui.GitCommand.Merge("FETCH_HEAD", commands.MergeOpts{})
|
||||
_ = gui.handleGenericMergeCommandResult(err)
|
||||
case "ff-only":
|
||||
err := gui.GitCommand.Merge("FETCH_HEAD", commands.MergeOpts{FastForwardOnly: true})
|
||||
_ = gui.handleGenericMergeCommandResult(err)
|
||||
default:
|
||||
_ = gui.createErrorPanel(fmt.Sprintf("git pull strategy '%s' unrecognised", strategy))
|
||||
}
|
||||
}()
|
||||
|
||||
@ -515,10 +518,7 @@ func (gui *Gui) pushWithForceFlag(g *gocui.Gui, v *gocui.View, force bool, upstr
|
||||
branchName := gui.getCheckedOutBranch().Name
|
||||
err := gui.GitCommand.Push(branchName, force, upstream, args, gui.promptUserForCredential)
|
||||
gui.HandleCredentialsPopup(err)
|
||||
if err == nil {
|
||||
_ = gui.closeConfirmationPrompt(gui.g, true)
|
||||
_ = gui.refreshSidePanels(refreshOptions{mode: ASYNC})
|
||||
}
|
||||
_ = gui.refreshSidePanels(refreshOptions{mode: ASYNC})
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user