mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-03 13:21:56 +02:00
more password checks on commands that talk to the remote
This commit is contained in:
parent
3df0a9f132
commit
031e97ef91
@ -1,6 +1,8 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||
)
|
||||
|
||||
@ -20,8 +22,9 @@ func (c *GitCommand) UpdateRemoteUrl(remoteName string, updatedUrl string) error
|
||||
return c.OSCommand.RunCommand("git remote set-url %s %s", remoteName, updatedUrl)
|
||||
}
|
||||
|
||||
func (c *GitCommand) DeleteRemoteBranch(remoteName string, branchName string) error {
|
||||
return c.OSCommand.RunCommand("git push %s --delete %s", remoteName, branchName)
|
||||
func (c *GitCommand) DeleteRemoteBranch(remoteName string, branchName string, promptUserForCredential func(string) string) error {
|
||||
command := fmt.Sprintf("git push %s --delete %s", remoteName, branchName)
|
||||
return c.OSCommand.DetectUnamePass(command, promptUserForCredential)
|
||||
}
|
||||
|
||||
// CheckRemoteBranchExists Returns remote branch
|
||||
|
@ -1,5 +1,7 @@
|
||||
package commands
|
||||
|
||||
import "fmt"
|
||||
|
||||
func (c *GitCommand) CreateLightweightTag(tagName string, commitSha string) error {
|
||||
return c.OSCommand.RunCommand("git tag %s %s", tagName, commitSha)
|
||||
}
|
||||
@ -8,6 +10,7 @@ func (c *GitCommand) DeleteTag(tagName string) error {
|
||||
return c.OSCommand.RunCommand("git tag -d %s", tagName)
|
||||
}
|
||||
|
||||
func (c *GitCommand) PushTag(remoteName string, tagName string) error {
|
||||
return c.OSCommand.RunCommand("git push %s %s", remoteName, tagName)
|
||||
func (c *GitCommand) PushTag(remoteName string, tagName string, promptUserForCredential func(string) string) error {
|
||||
command := fmt.Sprintf("git push %s %s", remoteName, tagName)
|
||||
return c.OSCommand.DetectUnamePass(command, promptUserForCredential)
|
||||
}
|
||||
|
@ -60,9 +60,8 @@ func (gui *Gui) handleDeleteRemoteBranch(g *gocui.Gui, v *gocui.View) error {
|
||||
prompt: message,
|
||||
handleConfirm: func() error {
|
||||
return gui.WithWaitingStatus(gui.Tr.DeletingStatus, func() error {
|
||||
if err := gui.GitCommand.DeleteRemoteBranch(remoteBranch.RemoteName, remoteBranch.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
err := gui.GitCommand.DeleteRemoteBranch(remoteBranch.RemoteName, remoteBranch.Name, gui.promptUserForCredential)
|
||||
gui.handleCredentialsPopup(err)
|
||||
|
||||
return gui.refreshSidePanels(refreshOptions{scope: []int{BRANCHES, REMOTES}})
|
||||
})
|
||||
|
@ -166,7 +166,6 @@ func (gui *Gui) handleFetchRemote(g *gocui.Gui, v *gocui.View) error {
|
||||
gui.Mutexes.FetchMutex.Lock()
|
||||
defer gui.Mutexes.FetchMutex.Unlock()
|
||||
|
||||
// TODO: test this
|
||||
err := gui.GitCommand.FetchRemote(remote.Name, gui.promptUserForCredential)
|
||||
gui.handleCredentialsPopup(err)
|
||||
|
||||
|
@ -98,10 +98,12 @@ func (gui *Gui) handlePushTag(g *gocui.Gui, v *gocui.View) error {
|
||||
)
|
||||
|
||||
return gui.prompt(title, "origin", func(response string) error {
|
||||
if err := gui.GitCommand.PushTag(response, tag.Name); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
return nil
|
||||
return gui.WithWaitingStatus(gui.Tr.PushingTagStatus, func() error {
|
||||
err := gui.GitCommand.PushTag(response, tag.Name, gui.promptUserForCredential)
|
||||
gui.handleCredentialsPopup(err)
|
||||
|
||||
return nil
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -427,6 +427,7 @@ type TranslationSet struct {
|
||||
SubCommitsTitle string
|
||||
SubmodulesTitle string
|
||||
NavigationTitle string
|
||||
PushingTagStatus string
|
||||
}
|
||||
|
||||
const englishReleaseNotes = `## lazygit 0.23.2 Release Notes
|
||||
@ -924,5 +925,6 @@ func englishTranslationSet() TranslationSet {
|
||||
SubCommitsTitle: "Sub-commits",
|
||||
SubmodulesTitle: "Submodules",
|
||||
NavigationTitle: "List Panel Navigation",
|
||||
PushingTagStatus: "pushing tag",
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user