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

Re: [PATCH 0/2] clone: suppress unexpected advice message during clone

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Mar 21, 2025, 16:42 UTC
Message-ID
<1849284e-b5cc-40fd-ba59-43559a20ac2e@gmail.com>
In-Reply-To
<yyeid3njdsmws7rl3kcsxne52fuadd7q4emqdlvatwvcrnyl42@rfnk26mvcgoa>
On 20/03/2025 23:48, Justin Tobler wrote:
Show 22 quoted lines
> On 25/03/20 11:10AM, Phillip Wood wrote:
>> Hi Justin
>>
>> On 20/03/2025 01:46, Justin Tobler wrote:
>>>
>>> A side-effect of this change is that the location of the first
>>> `git_default_branch_name()` gets deferred to a later point of execution.
>>> This matters because `git_default_branch_name()` only computes the
>>> default branch name once and returns a cached value for subsequent
>>> invocations. After this change, the `git_default_branch_name()` call
>>> site that actually computes the value becomes `guess_remote_head()` and
>>> is configured to always show the advice message.
>>
>> Isn't the fundamental cause of this bug that advise() ignores GIT_ADVICE?
>> I'm not really clear why "git --no-advice" only applies to advice that is
>> guarded by advice_enabled() when it is documented as disabling all advice
>> hints.
> 
>  From my point of view, this advice message should never be presented in
> this particular scenario regardless of the configuration as it doesn't
> make much sense here. This also happens to be the original behavior so I
> think we should probably return to that state.

Oh, good point. So the original report actually highlights two bugs - the regression you're fixing here and the fact that "--no-advice" does not suppress the advice.

Show 7 quoted lines
> I was also a bit suprised to see that not all advice messages respect
> the `--no-advice` option. I'm not sure if there is a reason for this, or if
> `advise_if_enabled()` just came later and not everything was converted.
> 
> In general though, other users of the default branch name advice message
> should probably follow the `--no-advice` option. I'll add another patch
> that does this in the next version.
That would be great,
Thanks
Phillip
> Thanks,
> -Justin
> 
Previous: Justin ToblerNext: Justin Tobler
Message 15 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.