mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
advice: allow disabling default branch name advice
The default branch name advice message is displayed when `repo_default_branch_name()` is invoked and the `init.defaultBranch` config is not set. In this scenario, the advice message is always shown even if the `--no-advice` option is used. Adapt `repo_default_branch_name()` to allow the default branch name advice message to be disabled with the `--no-advice` option and corresponding configuration. Signed-off-by: Justin Tobler <jltobler@gmail.com> Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
c039a46e99
commit
ec0f362e86
3
refs.c
3
refs.c
@@ -664,7 +664,8 @@ char *repo_default_branch_name(struct repository *r, int quiet)
|
||||
if (!ret) {
|
||||
ret = xstrdup("master");
|
||||
if (!quiet)
|
||||
advise(_(default_branch_name_advice), ret);
|
||||
advise_if_enabled(ADVICE_DEFAULT_BRANCH_NAME,
|
||||
_(default_branch_name_advice), ret);
|
||||
}
|
||||
|
||||
full_ref = xstrfmt("refs/heads/%s", ret);
|
||||
|
||||
Reference in New Issue
Block a user