summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkg/commands/git.go14
-rw-r--r--pkg/gui/credentials_panel.go4
-rw-r--r--pkg/gui/files_panel.go4
-rw-r--r--pkg/gui/global_handlers.go2
4 files changed, 12 insertions, 12 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go
index 249221c1f..819bcca6a 100644
--- a/pkg/commands/git.go
+++ b/pkg/commands/git.go
@@ -370,10 +370,10 @@ func (c *GitCommand) RebaseBranch(branchName string) error {
}
// Fetch fetch git repo
-func (c *GitCommand) Fetch(unamePassQuestion func(string) string, canAskForCredentials bool) error {
+func (c *GitCommand) Fetch(promptUserForCredential func(string) string, canPromptForCredential bool) error {
return c.OSCommand.DetectUnamePass("git fetch", func(question string) string {
- if canAskForCredentials {
- return unamePassQuestion(question)
+ if canPromptForCredential {
+ return promptUserForCredential(question)
}
return "\n"
})
@@ -486,8 +486,8 @@ func (c *GitCommand) AmendHead() (*exec.Cmd, error) {
}
// Pull pulls from repo
-func (c *GitCommand) Pull(args string, ask func(string) string) error {
- return c.OSCommand.DetectUnamePass("git pull --no-edit "+args, ask)
+func (c *GitCommand) Pull(args string, promptUserForCredential func(string) string) error {
+ return c.OSCommand.DetectUnamePass("git pull --no-edit "+args, promptUserForCredential)
}
// PullWithoutPasswordCheck assumes that the pull will not prompt the user for a password
@@ -496,7 +496,7 @@ func (c *GitCommand) PullWithoutPasswordCheck(args string) error {
}
// Push pushes to a branch
-func (c *GitCommand) Push(branchName string, force bool, upstream string, args string, ask func(string) string) error {
+func (c *GitCommand) Push(branchName string, force bool, upstream string, args string, promptUserForCredential func(string) string) error {
forceFlag := ""
if force {
forceFlag = "--force-with-lease"
@@ -508,7 +508,7 @@ func (c *GitCommand) Push(branchName string, force bool, upstream string, args s
}
cmd := fmt.Sprintf("git push --follow-tags %s %s %s", forceFlag, setUpstreamArg, args)
- return c.OSCommand.DetectUnamePass(cmd, ask)
+ return c.OSCommand.DetectUnamePass(cmd, promptUserForCredential)
}
// CatFile obtains the content of a file
diff --git a/pkg/gui/credentials_panel.go b/pkg/gui/credentials_panel.go
index d1696b163..3943055a7 100644
--- a/pkg/gui/credentials_panel.go
+++ b/pkg/gui/credentials_panel.go
@@ -8,8 +8,8 @@ import (
type credentials chan string
-// waitForPassUname wait for a username or password input from the credentials popup
-func (gui *Gui) waitForPassUname(passOrUname string) string {
+// promptUserForCredential wait for a username or password input from the credentials popup
+func (gui *Gui) promptUserForCredential(passOrUname string) string {
gui.credentials = make(chan string)
gui.g.Update(func(g *gocui.Gui) error {
credentialsView, _ := g.View("credentials")
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go
index 5194aa82c..437940c1f 100644
--- a/pkg/gui/files_panel.go
+++ b/pkg/gui/files_panel.go
@@ -477,7 +477,7 @@ func (gui *Gui) pullFiles(v *gocui.View, args string) error {
// what if we had a struct which contained an array of functions to run, each of which return a function, or perhaps write to a channel when they're done, and if there is no error, we run the next thing. In this case we first want to fetch, potentially handling a credential popup, then we want to rebase.
go func() {
- err := gui.GitCommand.Pull(args, gui.waitForPassUname)
+ err := gui.GitCommand.Pull(args, gui.promptUserForCredential)
// gui.handleGenericMergeCommandResult(err)
gui.HandleCredentialsPopup(gui.g, err)
}()
@@ -491,7 +491,7 @@ func (gui *Gui) pushWithForceFlag(g *gocui.Gui, v *gocui.View, force bool, upstr
}
go func() {
branchName := gui.getCheckedOutBranch().Name
- err := gui.GitCommand.Push(branchName, force, upstream, args, gui.waitForPassUname)
+ err := gui.GitCommand.Push(branchName, force, upstream, args, gui.promptUserForCredential)
gui.HandleCredentialsPopup(g, err)
}()
return nil
diff --git a/pkg/gui/global_handlers.go b/pkg/gui/global_handlers.go
index 4c9c5cf37..d66e56021 100644
--- a/pkg/gui/global_handlers.go
+++ b/pkg/gui/global_handlers.go
@@ -167,7 +167,7 @@ func (gui *Gui) handleInfoClick(g *gocui.Gui, v *gocui.View) error {
}
func (gui *Gui) fetch(g *gocui.Gui, v *gocui.View, canAskForCredentials bool) (err error) {
- err = gui.GitCommand.Fetch(gui.waitForPassUname, canAskForCredentials)
+ err = gui.GitCommand.Fetch(gui.promptUserForCredential, canAskForCredentials)
if canAskForCredentials && err != nil && strings.Contains(err.Error(), "exit status 128") {
colorFunction := color.New(color.FgRed).SprintFunc()