diff options
| author | Justin Tobler <jltobler@gmail.com> | 2025-03-24 19:51:46 -0500 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-03-25 16:09:27 -0700 |
| commit | d5d284df910b5f03681b480ae061bb1435b3b4b2 (patch) | |
| tree | 44349ee09df44c6039fd7afeedadada8b8f6d316 /remote.h | |
| parent | 683c54c999c301c2cd6f715c411407c413b1d84e (diff) | |
| download | git-d5d284df910b5f03681b480ae061bb1435b3b4b2.tar.xz | |
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 <jltobler@gmail.com>
Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.h')
| -rw-r--r-- | remote.h | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -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); |
