diff options
author | mjarkk <mkopenga@gmail.com> | 2018-12-07 14:56:29 +0100 |
---|---|---|
committer | mjarkk <mkopenga@gmail.com> | 2018-12-07 14:56:29 +0100 |
commit | 8f904ffd720714fb315c69d1c44d6974842ab051 (patch) | |
tree | 7b1ee38a1c8483c5f894bc0353ed2a0ceb4f30d7 /pkg/gui | |
parent | ced81e11f048a954b707996d78487e3a6cabd569 (diff) |
Working popup
Diffstat (limited to 'pkg/gui')
-rw-r--r-- | pkg/gui/branches_panel.go | 24 | ||||
-rw-r--r-- | pkg/gui/commit_message_panel.go | 2 | ||||
-rw-r--r-- | pkg/gui/gui.go | 13 |
3 files changed, 32 insertions, 7 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 7d1ca5782..059f0af50 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -34,7 +34,29 @@ func (gui *Gui) handleCreatePullRequestPress(g *gocui.Gui, v *gocui.View) error } func (gui *Gui) handleGitFetch(g *gocui.Gui, v *gocui.View) error { - return gui.fetch(g, v, true) + if err := gui.createMessagePanel(g, v, "", gui.Tr.SLocalize("FetchWait")); err != nil { + return err + } + go func() { + unamePassOpend, err := gui.fetch(g, v, true) + if err != nil { + errMessage := err.Error() + if errMessage == "exit status 128" { + errMessage = gui.Tr.SLocalize("PassUnameWrong") + } + _ = gui.createErrorPanel(g, errMessage) + } + if unamePassOpend { + _, _ = g.SetViewOnBottom("pushPassUname") + _ = g.DeleteView("pushPassUname") + } + if err == nil { + _ = gui.closeConfirmationPrompt(g) + _ = gui.refreshCommits(g) + _ = gui.refreshStatus(g) + } + }() + return nil } func (gui *Gui) handleForceCheckout(g *gocui.Gui, v *gocui.View) error { diff --git a/pkg/gui/commit_message_panel.go b/pkg/gui/commit_message_panel.go index 560f64415..14e3ab795 100644 --- a/pkg/gui/commit_message_panel.go +++ b/pkg/gui/commit_message_panel.go @@ -115,7 +115,7 @@ func (gui *Gui) handlePushClose(g *gocui.Gui, v *gocui.View) error { if err != nil { return err } - gui.credentials <- "" + gui.credentials <- "-" return gui.switchFocus(g, v, gui.getFilesView(g)) } diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index e3d80df12..0004abf1b 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -371,8 +371,10 @@ func (gui *Gui) promptAnonymousReporting() error { }) } -func (gui *Gui) fetch(g *gocui.Gui, v *gocui.View, canSskForCredentials bool) error { - err := gui.GitCommand.Fetch(func(passOrUname string) string { +func (gui *Gui) fetch(g *gocui.Gui, v *gocui.View, canSskForCredentials bool) (unamePassOpend bool, err error) { + unamePassOpend = false + err = gui.GitCommand.Fetch(func(passOrUname string) string { + unamePassOpend = true return gui.waitForPassUname(gui.g, v, passOrUname) }, canSskForCredentials) @@ -386,7 +388,7 @@ func (gui *Gui) fetch(g *gocui.Gui, v *gocui.View, canSskForCredentials bool) er } gui.refreshStatus(g) - return err + return unamePassOpend, err } func (gui *Gui) updateLoader(g *gocui.Gui) error { @@ -442,12 +444,13 @@ func (gui *Gui) Run() error { } go func() { - err := gui.fetch(g, g.CurrentView(), false) + _, err := gui.fetch(g, g.CurrentView(), false) if err != nil && strings.Contains(err.Error(), "exit status 128") && gui.canShowIsPrivateRepo() { _ = gui.createConfirmationPanel(g, g.CurrentView(), gui.Tr.SLocalize("NoAutomaticGitFetchTitle"), gui.Tr.SLocalize("NoAutomaticGitFetchBody"), nil, nil) } else { gui.goEvery(g, time.Second*60, func(g *gocui.Gui) error { - return gui.fetch(g, g.CurrentView(), false) + _, err := gui.fetch(g, g.CurrentView(), false) + return err }) } }() |