Subject: Re: [PATCH 2/2] clone: suppress unexpected default branch advice

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 20 Mar 2025 06:13:53 +0100

On Wed, Mar 19, 2025 at 08:46:46PM -0500, Justin Tobler wrote:
> diff --git a/builtin/clone.c b/builtin/clone.c
> index 9eb66234bc..3b166b05e3 100644
> --- a/builtin/clone.c
> +++ b/builtin/clone.c
> @@ -1523,7 +1523,7 @@ int cmd_clone(int argc,
>  	}
>  
>  	remote_head = find_ref_by_name(refs, "HEAD");
> -	remote_head_points_at = guess_remote_head(remote_head, mapped_refs, 0, 0);
> +	remote_head_points_at = guess_remote_head(remote_head, mapped_refs, 0, 1);
>  
>  	if (option_branch) {
>  		our_head_points_at = find_remote_branch(mapped_refs, option_branch);

Makes sense. You don't have control over the branch name anyway when
cloning, so it's nonsensical to print that advise. Another subsequent
step could be to turn the `advise()` into `advise_if_enabled()`, but
that change isn't really needed for git-clone(1) because there wouldn't
ever be a reason to print it.

Do we want to add a test somewhere that demonstrates that we don't print
the advise anymore?

Thanks for fixing this!

Patrick