mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-09 13:47:11 +02:00
Added files to commit pannelsidjfjlisdjfilisldjfiljisldjilfjisdjilfjlsidMoved some code around
This commit is contained in:
parent
9fc4262887
commit
01fa106de3
@ -333,24 +333,14 @@ func (c *GitCommand) Pull() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Push pushes to a branch
|
// 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 := ""
|
forceFlag := ""
|
||||||
if force {
|
if force {
|
||||||
forceFlag = "--force-with-lease "
|
forceFlag = "--force-with-lease "
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := fmt.Sprintf("git push %s -u origin %s", forceFlag, branchName)
|
cmd := fmt.Sprintf("git push %s -u origin %s", forceFlag, branchName)
|
||||||
return c.OSCommand.DetectUnamePass(cmd, func(passOrUname string) string {
|
return c.OSCommand.DetectUnamePass(cmd, ask)
|
||||||
if passOrUname == "password" {
|
|
||||||
// ask for password
|
|
||||||
return "some password"
|
|
||||||
}
|
|
||||||
if passOrUname == "username" {
|
|
||||||
// ask for username
|
|
||||||
return "some username"
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SquashPreviousTwoCommits squashes a commit down to the one below it
|
// SquashPreviousTwoCommits squashes a commit down to the one below it
|
||||||
|
@ -361,7 +361,15 @@ func (gui *Gui) pushWithForceFlag(currentView *gocui.View, force bool) error {
|
|||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
branchName := gui.State.Branches[0].Name
|
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())
|
_ = gui.createErrorPanel(gui.g, err.Error())
|
||||||
} else {
|
} else {
|
||||||
_ = gui.closeConfirmationPrompt(gui.g)
|
_ = gui.closeConfirmationPrompt(gui.g)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user