mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-25 12:24:47 +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
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
"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)
|
return c.OSCommand.RunCommand("git remote set-url %s %s", remoteName, updatedUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *GitCommand) DeleteRemoteBranch(remoteName string, branchName string) error {
|
func (c *GitCommand) DeleteRemoteBranch(remoteName string, branchName string, promptUserForCredential func(string) string) error {
|
||||||
return c.OSCommand.RunCommand("git push %s --delete %s", remoteName, branchName)
|
command := fmt.Sprintf("git push %s --delete %s", remoteName, branchName)
|
||||||
|
return c.OSCommand.DetectUnamePass(command, promptUserForCredential)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckRemoteBranchExists Returns remote branch
|
// CheckRemoteBranchExists Returns remote branch
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package commands
|
package commands
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
func (c *GitCommand) CreateLightweightTag(tagName string, commitSha string) error {
|
func (c *GitCommand) CreateLightweightTag(tagName string, commitSha string) error {
|
||||||
return c.OSCommand.RunCommand("git tag %s %s", tagName, commitSha)
|
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)
|
return c.OSCommand.RunCommand("git tag -d %s", tagName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *GitCommand) PushTag(remoteName string, tagName string) error {
|
func (c *GitCommand) PushTag(remoteName string, tagName string, promptUserForCredential func(string) string) error {
|
||||||
return c.OSCommand.RunCommand("git push %s %s", remoteName, tagName)
|
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,
|
prompt: message,
|
||||||
handleConfirm: func() error {
|
handleConfirm: func() error {
|
||||||
return gui.WithWaitingStatus(gui.Tr.DeletingStatus, func() error {
|
return gui.WithWaitingStatus(gui.Tr.DeletingStatus, func() error {
|
||||||
if err := gui.GitCommand.DeleteRemoteBranch(remoteBranch.RemoteName, remoteBranch.Name); err != nil {
|
err := gui.GitCommand.DeleteRemoteBranch(remoteBranch.RemoteName, remoteBranch.Name, gui.promptUserForCredential)
|
||||||
return err
|
gui.handleCredentialsPopup(err)
|
||||||
}
|
|
||||||
|
|
||||||
return gui.refreshSidePanels(refreshOptions{scope: []int{BRANCHES, REMOTES}})
|
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()
|
gui.Mutexes.FetchMutex.Lock()
|
||||||
defer gui.Mutexes.FetchMutex.Unlock()
|
defer gui.Mutexes.FetchMutex.Unlock()
|
||||||
|
|
||||||
// TODO: test this
|
|
||||||
err := gui.GitCommand.FetchRemote(remote.Name, gui.promptUserForCredential)
|
err := gui.GitCommand.FetchRemote(remote.Name, gui.promptUserForCredential)
|
||||||
gui.handleCredentialsPopup(err)
|
gui.handleCredentialsPopup(err)
|
||||||
|
|
||||||
|
@ -98,11 +98,13 @@ func (gui *Gui) handlePushTag(g *gocui.Gui, v *gocui.View) error {
|
|||||||
)
|
)
|
||||||
|
|
||||||
return gui.prompt(title, "origin", func(response string) error {
|
return gui.prompt(title, "origin", func(response string) error {
|
||||||
if err := gui.GitCommand.PushTag(response, tag.Name); err != nil {
|
return gui.WithWaitingStatus(gui.Tr.PushingTagStatus, func() error {
|
||||||
return gui.surfaceError(err)
|
err := gui.GitCommand.PushTag(response, tag.Name, gui.promptUserForCredential)
|
||||||
}
|
gui.handleCredentialsPopup(err)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleCreateTag(g *gocui.Gui, v *gocui.View) error {
|
func (gui *Gui) handleCreateTag(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
@ -427,6 +427,7 @@ type TranslationSet struct {
|
|||||||
SubCommitsTitle string
|
SubCommitsTitle string
|
||||||
SubmodulesTitle string
|
SubmodulesTitle string
|
||||||
NavigationTitle string
|
NavigationTitle string
|
||||||
|
PushingTagStatus string
|
||||||
}
|
}
|
||||||
|
|
||||||
const englishReleaseNotes = `## lazygit 0.23.2 Release Notes
|
const englishReleaseNotes = `## lazygit 0.23.2 Release Notes
|
||||||
@ -924,5 +925,6 @@ func englishTranslationSet() TranslationSet {
|
|||||||
SubCommitsTitle: "Sub-commits",
|
SubCommitsTitle: "Sub-commits",
|
||||||
SubmodulesTitle: "Submodules",
|
SubmodulesTitle: "Submodules",
|
||||||
NavigationTitle: "List Panel Navigation",
|
NavigationTitle: "List Panel Navigation",
|
||||||
|
PushingTagStatus: "pushing tag",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user