aboutsummaryrefslogtreecommitdiff
path: root/remote.h
diff options
context:
space:
mode:
authorJustin Tobler <jltobler@gmail.com>2025-03-24 19:51:46 -0500
committerJunio C Hamano <gitster@pobox.com>2025-03-25 16:09:27 -0700
commitd5d284df910b5f03681b480ae061bb1435b3b4b2 (patch)
tree44349ee09df44c6039fd7afeedadada8b8f6d316 /remote.h
parent683c54c999c301c2cd6f715c411407c413b1d84e (diff)
downloadgit-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.h11
1 files changed, 7 insertions, 4 deletions
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);