From cc0f13c57dedaf62c9f852b6bf363aee7e3392f1 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 11 Dec 2020 11:36:56 +0000 Subject: 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 Signed-off-by: Junio C Hamano --- remote.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'remote.c') diff --git a/remote.c b/remote.c index 8a6dbbb903..bdb88d4b7d 100644 --- a/remote.c +++ b/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); -- cgit 1.2.3-korg