summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2020-12-11 11:36:56 +0000
committerJunio C Hamano <gitster@pobox.com>2020-12-13 15:53:50 -0800
commitcc0f13c57dedaf62c9f852b6bf363aee7e3392f1 (patch)
tree4e86592e9f3f0e31f34b7bce9253f34d18c96e34 /remote.c
parentcfaff3aac8063ec72f03c6761328c7fa44a15b34 (diff)
downloadgit-cc0f13c57dedaf62c9f852b6bf363aee7e3392f1.tar.gz
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>
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c5
1 files changed, 3 insertions, 2 deletions
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);