diff options
author | Luka Markušić <luka.markusic@microblink.com> | 2022-06-30 13:53:58 +0200 |
---|---|---|
committer | Luka Markušić <luka.markusic@microblink.com> | 2022-06-30 13:53:58 +0200 |
commit | f1efa026404e9702da2881fd5c3c35e190bad03b (patch) | |
tree | 317171f0e8f4ac33722bc5a8c27ada385a4c1abf /pkg/app | |
parent | 41071c37035a5944f77b4f0da5f07ec3b52fef0e (diff) |
Ask for initial branch name
Diffstat (limited to 'pkg/app')
-rw-r--r-- | pkg/app/app.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pkg/app/app.go b/pkg/app/app.go index a5a241ac5..9a7b1ffcc 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -173,12 +173,20 @@ func (app *App) setupRepo() (bool, error) { shouldInitRepo := true notARepository := app.UserConfig.NotARepository + initialBranch := "" if notARepository == "prompt" { // Offer to initialize a new repository in current directory. fmt.Print(app.Tr.CreateRepo) response, _ := bufio.NewReader(os.Stdin).ReadString('\n') if strings.Trim(response, " \r\n") != "y" { shouldInitRepo = false + } else { + // Ask for the initial branch name + fmt.Print(app.Tr.InitialBranch) + response, _ := bufio.NewReader(os.Stdin).ReadString('\n') + if trimmedResponse := strings.Trim(response, " \r\n"); len(trimmedResponse) > 0 { + initialBranch += "--initial-branch=" + trimmedResponse + } } } else if notARepository == "skip" { shouldInitRepo = false @@ -197,7 +205,7 @@ func (app *App) setupRepo() (bool, error) { fmt.Println(app.Tr.NoRecentRepositories) os.Exit(1) } - if err := app.OSCommand.Cmd.New("git init").Run(); err != nil { + if err := app.OSCommand.Cmd.New("git init " + initialBranch).Run(); err != nil { return false, err } } |