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
5
remote.c
5
remote.c
@ -284,7 +284,7 @@ static void read_branches_file(struct remote *remote)
|
||||
if (frag)
|
||||
*(frag++) = '\0';
|
||||
else
|
||||
frag = (char *)git_default_branch_name();
|
||||
frag = (char *)git_default_branch_name(0);
|
||||
|
||||
add_url_alias(remote, strbuf_detach(&buf, NULL));
|
||||
refspec_appendf(&remote->fetch, "refs/heads/%s:refs/heads/%s",
|
||||
@ -2206,7 +2206,8 @@ struct ref *guess_remote_head(const struct ref *head,
|
||||
|
||||
/* If a remote branch exists with the default branch name, let's use it. */
|
||||
if (!all) {
|
||||
char *ref = xstrfmt("refs/heads/%s", git_default_branch_name());
|
||||
char *ref = xstrfmt("refs/heads/%s",
|
||||
git_default_branch_name(0));
|
||||
|
||||
r = find_ref_by_name(refs, ref);
|
||||
free(ref);
|
||||
|
||||
Reference in New Issue
Block a user