summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyooooooga <eial5q265e5@gmail.com>2021-10-09 12:55:00 +0900
committerRyooooooga <eial5q265e5@gmail.com>2021-10-09 12:55:00 +0900
commit154b6b09cbeb9ebd50d2a65f2a3545de7cd068ba (patch)
tree5c6b3dd631e4765e5bca3de91139ec7acd538d9a
parent292b780bd8e628cea253226f97849f65cd097463 (diff)
Quote ref names and branches
-rw-r--r--pkg/commands/sync.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/commands/sync.go b/pkg/commands/sync.go
index 7de5b8efd..583987625 100644
--- a/pkg/commands/sync.go
+++ b/pkg/commands/sync.go
@@ -37,10 +37,10 @@ func (c *GitCommand) Fetch(opts FetchOptions) error {
command := "git fetch"
if opts.RemoteName != "" {
- command = fmt.Sprintf("%s %s", command, opts.RemoteName)
+ command = fmt.Sprintf("%s %s", command, c.OSCommand.Quote(opts.RemoteName))
}
if opts.BranchName != "" {
- command = fmt.Sprintf("%s %s", command, opts.BranchName)
+ command = fmt.Sprintf("%s %s", command, c.OSCommand.Quote(opts.BranchName))
}
return c.OSCommand.DetectUnamePass(command, func(question string) string {
@@ -52,12 +52,12 @@ func (c *GitCommand) Fetch(opts FetchOptions) error {
}
func (c *GitCommand) FastForward(branchName string, remoteName string, remoteBranchName string, promptUserForCredential func(string) string) error {
- command := fmt.Sprintf("git fetch %s %s:%s", remoteName, remoteBranchName, branchName)
+ command := fmt.Sprintf("git fetch %s %s:%s", c.OSCommand.Quote(remoteName), c.OSCommand.Quote(remoteBranchName), c.OSCommand.Quote(branchName))
return c.OSCommand.DetectUnamePass(command, promptUserForCredential)
}
func (c *GitCommand) FetchRemote(remoteName string, promptUserForCredential func(string) string) error {
- command := fmt.Sprintf("git fetch %s", remoteName)
+ command := fmt.Sprintf("git fetch %s", c.OSCommand.Quote(remoteName))
return c.OSCommand.DetectUnamePass(command, promptUserForCredential)
}