On Wed, Dec 06, 2023 at 01:39:44PM +0100, Patrick Steinhardt wrote: > Hi, > > when using git-clone(1), we initialize the complete repository before we > know about the object format used by the remote repository. This means > that we'll potentially create the refdb with the wrong object format in > case the local default object format and remote object format are not > the same. > > This isn't much of a problem in the context of the files backend, which > never records the object format anyway. But it is a problem for the > reftable backend, which indeed records the object format in the on-disk > data structures. The result is thus a reftable with wrong object format. > > This patch series aims to solve this issue by initializing the refdb at > a later point after we have learned about the remote object format. This > requires some careful reordering of code. Unfortunately, the end result > is not easily verifiable and thus I didn't add tests here. But it does > fix cloning of SHA256 repositories with the in-progress state of the > reftable backend. > > While at it I noticed that this actually fixes a bug with bundle URIs > when the object formats diverge in this way. > > The series is layed out as follows: > > - Patch 1 + 2: split out a function to create the refdb and make it > possible to skip its initialization in `init_db()`. > > - Patch 3: allows git-remote-curl(1) to work with repos that get > initialized during its lifetime. > > - Patch 4 - 6: address various corner cases where we access the refdb > before we learned about the object format. > > - Patch 7: move initialization of the refdb to happen after we have > learned about the object format. > > This patch series is actually the last incompatibility for the reftable > backend that I have found. All tests except for the files-backend > specific ones pass now with the current state I have at [1], which is > currently at e6f2f592b7 (t: skip tests which are incompatible with > reftable, 2023-11-24) I forgot to add the link to the merge request that contains the current reftable backend's implementation in case anybody is interested: https://gitlab.com/gitlab-org/git/-/merge_requests/58. Patrick > Thanks in advance for your reviews! > > Patrick > > Patrick Steinhardt (7): > setup: extract function to create the refdb > setup: allow skipping creation of the refdb > remote-curl: rediscover repository when fetching refs > builtin/clone: fix bundle URIs with mismatching object formats > builtin/clone: set up sparse checkout later > builtin/clone: skip reading HEAD when retrieving remote > builtin/clone: create the refdb with the correct object format > > builtin/clone.c | 65 ++++++++++++---------- > remote-curl.c | 7 ++- > remote.c | 26 +++++---- > remote.h | 1 + > setup.c | 106 +++++++++++++++++++++--------------- > setup.h | 6 +- > t/t5558-clone-bundle-uri.sh | 18 ++++++ > 7 files changed, 140 insertions(+), 89 deletions(-) > > -- > 2.43.0 >
Attachment:
signature.asc
Description: PGP signature