diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-11 17:18:58 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-11 17:18:58 +1000 |
commit | d4eae73a6801641dda23988d7722e7dffef71f0f (patch) | |
tree | 776163b22e25daba0dbb55daffaf7b9d35f16444 /pkg | |
parent | 5ba1eb278560f54071b731394ecd00b4cc99d4f3 (diff) |
Do not quote initial branch arg when creating repo
Also, we shouldn't pass the initial branch arg if it's empty.
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/app/app.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/app/app.go b/pkg/app/app.go index 59730780d..53e6e4411 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -194,7 +194,7 @@ func (app *App) setupRepo() (bool, error) { fmt.Print(app.Tr.InitialBranch) response, _ := bufio.NewReader(os.Stdin).ReadString('\n') if trimmedResponse := strings.Trim(response, " \r\n"); len(trimmedResponse) > 0 { - initialBranchArg += "--initial-branch=" + app.OSCommand.Quote(trimmedResponse) + initialBranchArg += "--initial-branch=" + trimmedResponse } } case "create": @@ -210,7 +210,11 @@ func (app *App) setupRepo() (bool, error) { } if shouldInitRepo { - if err := app.OSCommand.Cmd.New([]string{"git", "init", initialBranchArg}).Run(); err != nil { + args := []string{"git", "init"} + if initialBranchArg != "" { + args = append(args, initialBranchArg) + } + if err := app.OSCommand.Cmd.New(args).Run(); err != nil { return false, err } return false, nil |