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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 &&
        git -C bundle-repo bundle create ../repo.bundle --all &&
        git clone bundle.repo bundle-clone

This issue bisects to 199f44cb2ead (builtin/clone: allow remote helpers
to detect repo, 2024-02-27) where the refdb is partially initialized
during clones before remote helpers are executed. This partial
initilization creates the HEAD file and "refs/" directory.

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.

Also, `guess_remote_head()` only invokes `git_default_branch_name()` in
cases where the transport is unable to figure out the remote HEAD and
must guess. This explains why the advice message gets printed for bundle
clones, but not all clones.

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.

Thanks,
-Justin

[1]: <7EC98E2F-144D-4974-94F6-FC24B443651D@xxxxxxxxxxxx>

Justin Tobler (2):
  remote: allow `guess_remote_head()` to suppress advice
  clone: suppress unexpected default branch advice

 builtin/clone.c  | 4 ++--
 builtin/fetch.c  | 2 +-
 builtin/remote.c | 2 +-
 remote.c         | 4 ++--
 remote.h         | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)


base-commit: 683c54c999c301c2cd6f715c411407c413b1d84e
-- 
2.49.0





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux