diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-09-29 11:40:34 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-09-29 11:40:34 -0700 |
| commit | d960d6a6fbf4178ef4e9a093a63b0b48edf2f5e8 (patch) | |
| tree | d46a9a8fa284e8ef6b1d984c9f0a2cd3d15aca93 /refs.c | |
| parent | e50c3ca095b33a941833ffab150b8822099d1b75 (diff) | |
| parent | 373ad8917beb99dc643b6e7f5c117a294384a57e (diff) | |
| download | git-d960d6a6fbf4178ef4e9a093a63b0b48edf2f5e8.tar.xz | |
Merge branch 'jc/3.0-default-initial-branch-to-main-addendum'
Keep giving hint about the default initial branch name for users
who may be surprised after Git 3.0 switch-over.
* jc/3.0-default-initial-branch-to-main-addendum:
initial branch: give hints after switching the default name
Diffstat (limited to 'refs.c')
| -rw-r--r-- | refs.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -641,9 +641,17 @@ static const char default_branch_name_advice[] = N_( "\n" "\tgit branch -m <name>\n" ); +#else +static const char default_branch_name_advice[] = N_( +"Using '%s' as the name for the initial branch since Git 3.0.\n" +"If you expected Git to create 'master', the just-created\n" +"branch can be renamed via this command:\n" +"\n" +"\tgit branch -m master\n" +); #endif /* WITH_BREAKING_CHANGES */ -char *repo_default_branch_name(struct repository *r, MAYBE_UNUSED int quiet) +char *repo_default_branch_name(struct repository *r, int quiet) { const char *config_key = "init.defaultbranch"; const char *config_display_key = "init.defaultBranch"; @@ -660,10 +668,10 @@ char *repo_default_branch_name(struct repository *r, MAYBE_UNUSED int quiet) ret = xstrdup("main"); #else ret = xstrdup("master"); +#endif /* WITH_BREAKING_CHANGES */ if (!quiet) advise_if_enabled(ADVICE_DEFAULT_BRANCH_NAME, _(default_branch_name_advice), ret); -#endif /* WITH_BREAKING_CHANGES */ } full_ref = xstrfmt("refs/heads/%s", ret); |
