git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Patrick Steinhardt <ps@pks.im>
Date
Mar 20, 2025, 05:13 UTC
Message-ID
<Z9ukEUvuiPUQ3eiI@pks.im>
In-Reply-To
<20250320014646.2899791-3-jltobler@gmail.com>
On Wed, Mar 19, 2025 at 08:46:46PM -0500, Justin Tobler wrote:
Show 13 quoted lines
> 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
Previous: Justin ToblerNext: Justin Tobler
Message 11 of 32 in “bug: git shows hints that should be suppressed”
  1. alan@norbauer.comMar 19, 2025
  2. alan@norbauer.comMar 19, 2025
  3. Elijah NewrenMar 19, 2025
  4. Justin ToblerMar 20, 2025
  5. 0/2 clone: suppress unexpected advice message during cloneJustin Tobler, Mar 20, 2025
  6. 1/2 remote: allow `guess_remote_head()` to suppress adviceJustin Tobler, Mar 20, 2025
  7. Patrick SteinhardtMar 20, 2025
  8. Justin ToblerMar 20, 2025
  9. Junio C HamanoMar 21, 2025
  10. 2/2 clone: suppress unexpected default branch adviceJustin Tobler, Mar 20, 2025
  11. Patrick SteinhardtMar 20, 2025
  12. Justin ToblerMar 20, 2025
  13. Phillip WoodMar 20, 2025
  14. Justin ToblerMar 20, 2025
  15. Phillip WoodMar 21, 2025
  16. 0/3 clone: suppress unexpected advice message during cloneJustin Tobler, Mar 21, 2025
  17. 1/3 remote: allow `guess_remote_head()` to suppress adviceJustin Tobler, Mar 21, 2025
  18. Phillip WoodMar 24, 2025
  19. Justin ToblerMar 24, 2025
  20. phillip.wood123@gmail.comMar 24, 2025
  21. 2/3 builtin/clone: suppress unexpected default branch adviceJustin Tobler, Mar 21, 2025
  22. Phillip WoodMar 24, 2025
  23. Justin ToblerMar 24, 2025
  24. 3/3 advice: allow disabling default branch name adviceJustin Tobler, Mar 21, 2025
  25. Phillip WoodMar 24, 2025
  26. Junio C HamanoMar 23, 2025
  27. 0/3 clone: suppress unexpected advice message during cloneJustin Tobler, Mar 25, 2025
  28. 1/3 remote: allow `guess_remote_head()` to suppress adviceJustin Tobler, Mar 25, 2025
  29. 2/3 builtin/clone: suppress unexpected default branch adviceJustin Tobler, Mar 25, 2025
  30. 3/3 advice: allow disabling default branch name adviceJustin Tobler, Mar 25, 2025
  31. Phillip WoodMar 25, 2025
  32. alan@norbauer.comMar 20, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.