summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-04-15 13:50:16 -0700
committerJunio C Hamano <gitster@pobox.com>2025-04-15 13:50:16 -0700
commita8c207797f2fe624c4959487e3508dde96f68976 (patch)
tree6933bb5b61b08cc9adf218024a19a4651f6fd525 /remote.c
parentd690c44846b3e6450a98e09f43f4b40ec73f9762 (diff)
parentec0f362e869fc74c3c9f011ae2097daa1c938833 (diff)
Merge branch 'jt/clone-guess-remote-head-fix'
"git clone" still gave the message about the default branch name; this message has been turned into an advice message that can be turned off. * jt/clone-guess-remote-head-fix: advice: allow disabling default branch name advice builtin/clone: suppress unexpected default branch advice remote: allow `guess_remote_head()` to suppress advice
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/remote.c b/remote.c
index 25af97a44b..e7e10c7f4b 100644
--- a/remote.c
+++ b/remote.c
@@ -2297,7 +2297,7 @@ struct ref *get_local_heads(void)
struct ref *guess_remote_head(const struct ref *head,
const struct ref *refs,
- int all)
+ unsigned flags)
{
const struct ref *r;
struct ref *list = NULL;
@@ -2315,8 +2315,10 @@ struct ref *guess_remote_head(const struct ref *head,
return copy_ref(find_ref_by_name(refs, head->symref));
/* If a remote branch exists with the default branch name, let's use it. */
- if (!all) {
- char *default_branch = repo_default_branch_name(the_repository, 0);
+ if (!(flags & REMOTE_GUESS_HEAD_ALL)) {
+ char *default_branch =
+ repo_default_branch_name(the_repository,
+ flags & REMOTE_GUESS_HEAD_QUIET);
char *ref = xstrfmt("refs/heads/%s", default_branch);
r = find_ref_by_name(refs, ref);
@@ -2339,7 +2341,7 @@ struct ref *guess_remote_head(const struct ref *head,
oideq(&r->old_oid, &head->old_oid)) {
*tail = copy_ref(r);
tail = &((*tail)->next);
- if (!all)
+ if (!(flags & REMOTE_GUESS_HEAD_ALL))
break;
}
}