get_default_branch_name(): prepare for showing some advice
We are about to introduce a message giving users running `git init` some advice about `init.defaultBranch`. This will necessarily be done in `repo_default_branch_name()`. Not all code paths want to show that advice, though. In particular, the `git clone` codepath _specifically_ asks for `init_db()` to be quiet, via the `INIT_DB_QUIET` flag. In preparation for showing users above-mentioned advice, let's change the function signature of `get_default_branch_name()` to accept the parameter `quiet`. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
cfaff3aac8
commit
cc0f13c57d
6
refs.c
6
refs.c
@ -562,7 +562,7 @@ void expand_ref_prefix(struct strvec *prefixes, const char *prefix)
|
||||
strvec_pushf(prefixes, *p, len, prefix);
|
||||
}
|
||||
|
||||
char *repo_default_branch_name(struct repository *r)
|
||||
char *repo_default_branch_name(struct repository *r, int quiet)
|
||||
{
|
||||
const char *config_key = "init.defaultbranch";
|
||||
const char *config_display_key = "init.defaultBranch";
|
||||
@ -585,12 +585,12 @@ char *repo_default_branch_name(struct repository *r)
|
||||
return ret;
|
||||
}
|
||||
|
||||
const char *git_default_branch_name(void)
|
||||
const char *git_default_branch_name(int quiet)
|
||||
{
|
||||
static char *ret;
|
||||
|
||||
if (!ret)
|
||||
ret = repo_default_branch_name(the_repository);
|
||||
ret = repo_default_branch_name(the_repository, quiet);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user