1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-04 03:48:07 +02:00

update naming

This commit is contained in:
Jesse Duffield 2020-08-11 20:29:05 +10:00
parent 1b78a42b80
commit 1c0da2967c
4 changed files with 12 additions and 12 deletions

View File

@ -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

View File

@ -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")

View File

@ -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

View File

@ -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()