1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-25 12:24:47 +02:00

Fix git-remote commands

This commit is contained in:
Ryooooooga 2021-10-06 23:20:19 +09:00
parent eb7531b206
commit e19b4fe369
No known key found for this signature in database
GPG Key ID: 07CF200DFCC20C25

View File

@ -5,23 +5,23 @@ import (
) )
func (c *GitCommand) AddRemote(name string, url string) error { func (c *GitCommand) AddRemote(name string, url string) error {
return c.RunCommand("git remote add %s %s", name, url) return c.RunCommand("git remote add %s %s", c.OSCommand.Quote(name), c.OSCommand.Quote(url))
} }
func (c *GitCommand) RemoveRemote(name string) error { func (c *GitCommand) RemoveRemote(name string) error {
return c.RunCommand("git remote remove %s", name) return c.RunCommand("git remote remove %s", c.OSCommand.Quote(name))
} }
func (c *GitCommand) RenameRemote(oldRemoteName string, newRemoteName string) error { func (c *GitCommand) RenameRemote(oldRemoteName string, newRemoteName string) error {
return c.RunCommand("git remote rename %s %s", oldRemoteName, newRemoteName) return c.RunCommand("git remote rename %s %s", c.OSCommand.Quote(oldRemoteName), c.OSCommand.Quote(newRemoteName))
} }
func (c *GitCommand) UpdateRemoteUrl(remoteName string, updatedUrl string) error { func (c *GitCommand) UpdateRemoteUrl(remoteName string, updatedUrl string) error {
return c.RunCommand("git remote set-url %s %s", remoteName, updatedUrl) return c.RunCommand("git remote set-url %s %s", c.OSCommand.Quote(remoteName), c.OSCommand.Quote(updatedUrl))
} }
func (c *GitCommand) DeleteRemoteBranch(remoteName string, branchName string, promptUserForCredential func(string) string) error { func (c *GitCommand) DeleteRemoteBranch(remoteName string, branchName string, promptUserForCredential func(string) string) error {
command := fmt.Sprintf("git push %s --delete %s", remoteName, branchName) command := fmt.Sprintf("git push %s --delete %s", c.OSCommand.Quote(remoteName), c.OSCommand.Quote(branchName))
return c.OSCommand.DetectUnamePass(command, promptUserForCredential) return c.OSCommand.DetectUnamePass(command, promptUserForCredential)
} }