mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-29 23:17:32 +02:00
update naming
This commit is contained in:
parent
1b78a42b80
commit
1c0da2967c
@ -370,10 +370,10 @@ func (c *GitCommand) RebaseBranch(branchName string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fetch fetch git repo
|
// 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 {
|
return c.OSCommand.DetectUnamePass("git fetch", func(question string) string {
|
||||||
if canAskForCredentials {
|
if canPromptForCredential {
|
||||||
return unamePassQuestion(question)
|
return promptUserForCredential(question)
|
||||||
}
|
}
|
||||||
return "\n"
|
return "\n"
|
||||||
})
|
})
|
||||||
@ -486,8 +486,8 @@ func (c *GitCommand) AmendHead() (*exec.Cmd, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pull pulls from repo
|
// Pull pulls from repo
|
||||||
func (c *GitCommand) Pull(args string, ask func(string) string) error {
|
func (c *GitCommand) Pull(args string, promptUserForCredential func(string) string) error {
|
||||||
return c.OSCommand.DetectUnamePass("git pull --no-edit "+args, ask)
|
return c.OSCommand.DetectUnamePass("git pull --no-edit "+args, promptUserForCredential)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PullWithoutPasswordCheck assumes that the pull will not prompt the user for a password
|
// 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
|
// 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 := ""
|
forceFlag := ""
|
||||||
if force {
|
if force {
|
||||||
forceFlag = "--force-with-lease"
|
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)
|
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
|
// CatFile obtains the content of a file
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
type credentials chan string
|
type credentials chan string
|
||||||
|
|
||||||
// waitForPassUname wait for a username or password input from the credentials popup
|
// promptUserForCredential wait for a username or password input from the credentials popup
|
||||||
func (gui *Gui) waitForPassUname(passOrUname string) string {
|
func (gui *Gui) promptUserForCredential(passOrUname string) string {
|
||||||
gui.credentials = make(chan string)
|
gui.credentials = make(chan string)
|
||||||
gui.g.Update(func(g *gocui.Gui) error {
|
gui.g.Update(func(g *gocui.Gui) error {
|
||||||
credentialsView, _ := g.View("credentials")
|
credentialsView, _ := g.View("credentials")
|
||||||
|
@ -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.
|
// 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() {
|
go func() {
|
||||||
err := gui.GitCommand.Pull(args, gui.waitForPassUname)
|
err := gui.GitCommand.Pull(args, gui.promptUserForCredential)
|
||||||
// gui.handleGenericMergeCommandResult(err)
|
// gui.handleGenericMergeCommandResult(err)
|
||||||
gui.HandleCredentialsPopup(gui.g, 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() {
|
go func() {
|
||||||
branchName := gui.getCheckedOutBranch().Name
|
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)
|
gui.HandleCredentialsPopup(g, err)
|
||||||
}()
|
}()
|
||||||
return nil
|
return nil
|
||||||
|
@ -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) {
|
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") {
|
if canAskForCredentials && err != nil && strings.Contains(err.Error(), "exit status 128") {
|
||||||
colorFunction := color.New(color.FgRed).SprintFunc()
|
colorFunction := color.New(color.FgRed).SprintFunc()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user