1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-03 13:21:56 +02:00

Added files to commit pannelsidjfjlisdjfilisldjfiljisldjilfjisdjilfjlsidMoved some code around

This commit is contained in:
mjarkk 2018-10-17 21:12:33 +02:00
parent 9fc4262887
commit 01fa106de3
2 changed files with 11 additions and 13 deletions

View File

@ -333,24 +333,14 @@ func (c *GitCommand) Pull() error {
}
// Push pushes to a branch
func (c *GitCommand) Push(branchName string, force bool) error {
func (c *GitCommand) Push(branchName string, force bool, ask func(string) string) error {
forceFlag := ""
if force {
forceFlag = "--force-with-lease "
}
cmd := fmt.Sprintf("git push %s -u origin %s", forceFlag, branchName)
return c.OSCommand.DetectUnamePass(cmd, func(passOrUname string) string {
if passOrUname == "password" {
// ask for password
return "some password"
}
if passOrUname == "username" {
// ask for username
return "some username"
}
return ""
})
return c.OSCommand.DetectUnamePass(cmd, ask)
}
// SquashPreviousTwoCommits squashes a commit down to the one below it

View File

@ -361,7 +361,15 @@ func (gui *Gui) pushWithForceFlag(currentView *gocui.View, force bool) error {
}
go func() {
branchName := gui.State.Branches[0].Name
if err := gui.GitCommand.Push(branchName, force); err != nil {
err := gui.GitCommand.Push(branchName, force, func(passOrUname string) string {
if passOrUname == "password" {
// TODO: ask for password
return "some password"
}
// TODO: ask for username
return "some username"
})
if err != nil {
_ = gui.createErrorPanel(gui.g, err.Error())
} else {
_ = gui.closeConfirmationPrompt(gui.g)