From d5d284df910b5f03681b480ae061bb1435b3b4b2 Mon Sep 17 00:00:00 2001 From: Justin Tobler Date: Mon, 24 Mar 2025 19:51:46 -0500 Subject: remote: allow `guess_remote_head()` to suppress advice The `repo_default_branch_name()` invoked through `guess_remote_head()` is configured to always display the default branch advice message. Adapt `guess_remote_head()` to accept flags and convert the `all` parameter to a flag. Add the `REMOTE_GUESS_HEAD_QUIET` flag to to enable suppression of advice messages. Call sites are updated accordingly. Signed-off-by: Justin Tobler Acked-by: Phillip Wood Signed-off-by: Junio C Hamano --- remote.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'remote.h') diff --git a/remote.h b/remote.h index 6be5031f64..7e4943ae3a 100644 --- a/remote.h +++ b/remote.h @@ -387,15 +387,18 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb, int show_divergence_advice); struct ref *get_local_heads(void); + /* * Find refs from a list which are likely to be pointed to by the given HEAD - * ref. If 'all' is false, returns the most likely ref; otherwise, returns a - * list of all candidate refs. If no match is found (or 'head' is NULL), - * returns NULL. All returns are newly allocated and should be freed. + * ref. If REMOTE_GUESS_HEAD_ALL is set, return a list of all candidate refs; + * otherwise, return the most likely ref. If no match is found (or 'head' is + * NULL), returns NULL. All returns are newly allocated and should be freed. */ +#define REMOTE_GUESS_HEAD_ALL (1 << 0) +#define REMOTE_GUESS_HEAD_QUIET (1 << 1) struct ref *guess_remote_head(const struct ref *head, const struct ref *refs, - int all); + unsigned flags); /* Return refs which no longer exist on remote */ struct ref *get_stale_heads(struct refspec *rs, struct ref *fetch_map); -- cgit v1.3-6-g1900