Modify push prompt on repo create when bare

This commit is contained in:
William Martin 2024-11-11 16:17:06 +01:00
parent 8e63268aba
commit 7bcb063391
2 changed files with 7 additions and 2 deletions

View file

@ -652,8 +652,13 @@ func createFromLocal(opts *CreateOptions) error {
// don't prompt for push if there are no commits
if opts.Interactive && committed {
msg := fmt.Sprintf("Would you like to push commits from the current branch to %q?", baseRemote)
if repoType == bare {
msg = fmt.Sprintf("Would you like to mirror all refs to %q?", baseRemote)
}
var err error
opts.Push, err = opts.Prompter.Confirm(fmt.Sprintf("Would you like to push commits from the current branch to %q?", baseRemote), true)
opts.Push, err = opts.Prompter.Confirm(msg, true)
if err != nil {
return err
}

View file

@ -452,7 +452,7 @@ func Test_createRun(t *testing.T) {
switch message {
case "Add a remote?":
return true, nil
case `Would you like to push commits from the current branch to "origin"?`:
case `Would you like to mirror all refs to "origin"?`:
return true, nil
default:
return false, fmt.Errorf("unexpected confirm prompt: %s", message)