1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-03-03 15:02:52 +02:00

Do not quote initial branch arg when creating repo (#2771)

This commit is contained in:
Jesse Duffield 2023-07-11 17:21:55 +10:00 committed by GitHub
commit e15a99e626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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