clone: propagate object-format when cloning from void
commit8b214c2e9dda8fc5b8d49b978fd2c155b7596cd0
authorJunio C Hamano <gitster@pobox.com>
Wed, 5 Apr 2023 21:15:33 +0000 (5 14:15 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 5 Apr 2023 21:17:00 +0000 (5 14:17 -0700)
tree44f825343f0545ea20ba8f191b18f4756e7b182b
parentae73b2c8f1da39c39335ee76a0f95857712c22a7
clone: propagate object-format when cloning from void

A user could prepare an empty repository and set it to use SHA256 as
the object format.  The new repository created by "git clone" from
such a repository however would not record that it is expecting
objects in the same SHA256 format.  This works as expected if the
source repository is not empty.

Just like we started copying the name of the primary branch from the
remote repository even if it is unborn in 3d8314f8 (clone: propagate
empty remote HEAD even with other branches, 2022-07-07), lift the
code that records the object format out of the block executed only
when cloning from an instantiated repository, so that it works also
when cloning from an empty repository.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/clone.c
t/t5702-protocol-v2.sh