Subject: Re: [PATCH v2 0/3] clone: suppress unexpected advice message during clone

From: Junio C Hamano <[email-masked]>
Date: Sun, 23 Mar 2025 12:38:03 -0700

Justin Tobler <[email-masked]> writes:

> It has been reported[1] that starting in Git v2.45.0, cloning from a bundle
> results in the default branch name advice message always being displayed
> when it was previously not. It can be reproduced by the following:
>
>         git init bundle-repo &&
>         git -C bundle-repo --allow-empty -m init &&

Presumably this is "commit --allow-empty -m init" in the bundle-repo
repository?

>         git -C bundle-repo bundle create ../repo.bundle --all &&
>         git clone repo.bundle bundle-clone
>
> This issue bisects to 199f44cb2ead (builtin/clone: allow remote helpers
> ...
> This series addresses the issue by adapting `guess_remote_head()` to
> support configuring the underlying `git_default_branch_name()`, which
> has since been renamed to `repo_default_branch_name()`, to be quiet and
> suppress the advice message.

Nicely analyzed and described.

> Changes since V1:
>
>         - Instead of adding an additional boolean to
>           `guess_remote_head()` to suppress the advice message, the
>           function is adapted to accepts flags that accoplish the same
>           thing.
>
>         - Added a test to validate that the advice message is not being
>           printed.
>
>         - While we are here, added another patch to allow the default
>           branch name advice message to be suppressrd by the
>           `--no-advice` option.
>
> Thanks,
> -Justin

>
> [1]: <[email-masked]>
>
> Justin Tobler (3):
>   remote: allow `guess_remote_head()` to suppress advice
>   builtin/clone: suppress unexpected default branch advice
>   advice: allow disabling default branch name advice
>
>  advice.c                |  1 +
>  advice.h                |  1 +
>  builtin/clone.c         |  3 ++-
>  builtin/fetch.c         |  2 +-
>  builtin/remote.c        |  2 +-
>  refs.c                  |  3 ++-
>  remote.c                | 10 ++++++----
>  remote.h                | 11 +++++++----
>  t/t0001-init.sh         |  8 ++++++++
>  t/t5607-clone-bundle.sh | 12 ++++++++++++
>  10 files changed, 41 insertions(+), 12 deletions(-)
>
>
> base-commit: 683c54c999c301c2cd6f715c411407c413b1d84e