diff options
author | mjarkk <mkopenga@gmail.com> | 2018-10-20 19:44:56 +0200 |
---|---|---|
committer | mjarkk <mkopenga@gmail.com> | 2018-10-20 19:44:56 +0200 |
commit | ac03665df34e8be89672fb98e202b182d745fdaf (patch) | |
tree | b71acfb91f4717dcc0e05845a9a88eaaba23653e /pkg/gui | |
parent | 1be44eae84a3ec86adf749356c21d752d673223e (diff) |
Handled some errors
Diffstat (limited to 'pkg/gui')
-rw-r--r-- | pkg/gui/commit_message_panel.go | 16 | ||||
-rw-r--r-- | pkg/gui/files_panel.go | 1 |
2 files changed, 14 insertions, 3 deletions
diff --git a/pkg/gui/commit_message_panel.go b/pkg/gui/commit_message_panel.go index 39818a848..3f2225a7b 100644 --- a/pkg/gui/commit_message_panel.go +++ b/pkg/gui/commit_message_panel.go @@ -60,10 +60,11 @@ var waitForGroupActie = false func (gui *Gui) waitForPassUname(g *gocui.Gui, currentView *gocui.View, passOrUname string) string { waitForGroupActie = true waitForGroup.Add(1) + pushPassUnameView := gui.getPushPassUnameView(g) if passOrUname == "username" { pushPassUnameView.Title = gui.Tr.SLocalize("PushUsername") - // pushPassUnameView.Mask = 1 + pushPassUnameView.Mask = 0 } else { pushPassUnameView.Title = gui.Tr.SLocalize("PushPassword") pushPassUnameView.Mask = '*' @@ -80,15 +81,23 @@ func (gui *Gui) waitForPassUname(g *gocui.Gui, currentView *gocui.View, passOrUn gui.RenderCommitLength() return nil }) + + // wait for username/passwords input waitForGroup.Wait() return unamePassMessage } func (gui *Gui) handlePushConfirm(g *gocui.Gui, v *gocui.View) error { message := gui.trimmedContent(v) + if message == "" { + // make sure to input something + // if not dune the push progress will run forever + message = "-" + } unamePassMessage = message if waitForGroupActie { - defer waitForGroup.Done() + waitForGroup.Done() + waitForGroupActie = false } err := gui.refreshFiles(g) if err != nil { @@ -117,7 +126,8 @@ func (gui *Gui) handlePushClose(g *gocui.Gui, v *gocui.View) error { } unamePassMessage = "" if waitForGroupActie { - defer waitForGroup.Done() + waitForGroup.Done() + waitForGroupActie = false } return gui.switchFocus(g, v, gui.getFilesView(g)) } diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index 8083c0e6a..ac5a8412e 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -364,6 +364,7 @@ func (gui *Gui) pushWithForceFlag(g *gocui.Gui, currentView *gocui.View, force b err := gui.GitCommand.Push(branchName, force, func(passOrUname string) string { return gui.waitForPassUname(g, currentView, passOrUname) }) + _, _ = g.SetViewOnBottom("pushPassUname") if err != nil { errMessage := err.Error() if errMessage == "exit status 128" { |