From: Patrick Steinhardt <ps@pks.im>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: "Jeppe Øland" <joland@gmail.com>, git@vger.kernel.org
Subject: Re: 2.46 submodule breakage
Date: Wed, 7 Aug 2024 09:38:53 +0200 [thread overview]
Message-ID: <ZrMkje9VugtKz-gB@tanuki> (raw)
In-Reply-To: <ZrMWylPWZ8Tm5i45@tanuki>
[-- Attachment #1: Type: text/plain, Size: 3370 bytes --]
On Wed, Aug 07, 2024 at 08:40:10AM +0200, Patrick Steinhardt wrote:
> On Tue, Aug 06, 2024 at 02:26:35PM -0400, Eric Sunshine wrote:
> > On Tue, Aug 6, 2024 at 9:21 AM Jeppe Øland <joland@gmail.com> wrote:
> > > I did a bunch of testing to narrow down the cause:
> > >
> > > It is not related to the Windows port - all the testing was done in WSL.
> > > It only happens when the clone containing submodules is done with
> > > --ref-format=reftable.
> > > The commit breaking it is: 129cb1b99d hash: drop (mostly) unused
> > > `is_empty_{blob,tree}_sha1()` functions
> >
> > Cc:'ing Patrick, the author of that change.
>
> Thanks for Cc'ing me, and thanks for the report.
>
> I just wanted to say that I couldn't reproduce, but then spotted that
> you said that it only happens when using `--ref-format=reftable` during
> the git-clone(1) step. And indeed, that causes the following test to
> fail:
>
> test_expect_success 'recursive pull with different non-default ref format' '
> # Set up the initial structure. This is an upstream repository that has
> # a submodule, as well as a downstream clone of the upstream
> # repository.
> git init submodule &&
> test_commit -C submodule submodule-base &&
> git init upstream &&
> test_commit -C upstream upstream-base &&
> git -C upstream submodule add "file://$(pwd)/submodule" &&
> git -C upstream commit -m "upstream submodule" &&
> git clone --ref-format=reftable --recurse-submodules "file://$(pwd)/upstream" downstream &&
>
> # Update the submodule.
> test_commit -C submodule submodule-update &&
> git -C upstream/submodule pull &&
> git -C upstream commit -am "update the submodule" &&
>
> git -C downstream pull --recurse-submodules
> '
>
> The issue here is that the recursive clone causes a mixture of ref
> formats: the parent repository uses the "reftable" backend, whereas the
> child repository uses "files". In theory, I think Git should be able to
> handle a mixture of ref formats like this, but I'm not surprised that it
> actually fails in practice. The question is whether this is sensible, or
> whether submodules should use the same ref format as their parent.
>
> So it feels like the commit you have bisected this to only unearths this
> issue, but isn't the actual root cause.
>
> I'll investigate further and will try to come up with a patch later this
> week.
For the record, the fix is as simple as the below diff. We indeed end up
initializing submodule ref stores with the parent ref storage format,
not with the one of the subrepo. I'll spend some more time though to
check whether other commands are impacted, as well, and write some more
tests.
Patrick
diff --git a/refs.c b/refs.c
index 915aeb4d1d..e4b1f4f8b1 100644
--- a/refs.c
+++ b/refs.c
@@ -2011,7 +2011,7 @@ struct ref_store *repo_get_submodule_ref_store(struct repository *repo,
free(subrepo);
goto done;
}
- refs = ref_store_init(subrepo, the_repository->ref_storage_format,
+ refs = ref_store_init(subrepo, subrepo->ref_storage_format,
submodule_sb.buf,
REF_STORE_READ | REF_STORE_ODB);
register_ref_store_map(&repo->submodule_ref_stores, "submodule",
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-08-07 7:38 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-05 11:31 2.46 submodule breakage Jeppe Øland
2024-08-06 13:18 ` Jeppe Øland
2024-08-06 18:26 ` Eric Sunshine
2024-08-07 6:40 ` Patrick Steinhardt
2024-08-07 7:38 ` Patrick Steinhardt [this message]
2024-08-07 16:09 ` Junio C Hamano
2024-08-07 12:43 ` [PATCH 0/6] Improvements for ref storage formats with submodules Patrick Steinhardt
2024-08-07 12:43 ` [PATCH 1/6] builtin/submodule: allow cloning with different ref storage format Patrick Steinhardt
2024-08-07 14:45 ` [PATCH 0/6] Improvements for ref storage formats with submodules Jeppe Øland
2024-08-07 22:55 ` [PATCH 1/6] builtin/submodule: allow cloning with different ref storage format Junio C Hamano
2024-08-08 7:00 ` Patrick Steinhardt
2024-08-08 16:08 ` Junio C Hamano
2024-08-08 16:19 ` Patrick Steinhardt
2024-08-08 17:26 ` Junio C Hamano
2024-08-07 12:43 ` [PATCH 2/6] builtin/clone: propagate ref storage format to submodules Patrick Steinhardt
2024-08-07 23:07 ` Junio C Hamano
2024-08-07 12:43 ` [PATCH 3/6] refs: fix ref storage format for submodule ref stores Patrick Steinhardt
2024-08-07 12:44 ` [PATCH 4/6] submodule: fix leaking fetch tasks Patrick Steinhardt
2024-08-07 12:44 ` [PATCH 5/6] submodule: fix leaking seen submodule names Patrick Steinhardt
2024-08-07 12:44 ` [PATCH 6/6] object: fix leaking packfiles when closing object store Patrick Steinhardt
2024-08-07 13:18 ` [PATCH 0/6] Improvements for ref storage formats with submodules Patrick Steinhardt
2024-08-08 1:09 ` Junio C Hamano
2024-08-08 7:00 ` Patrick Steinhardt
2024-08-08 7:35 ` [PATCH v2 0/8] " Patrick Steinhardt
2024-08-08 7:35 ` [PATCH v2 1/8] git-submodule.sh: break overly long command lines Patrick Steinhardt
2024-08-08 7:35 ` [PATCH v2 2/8] builtin/submodule: allow cloning with different ref storage format Patrick Steinhardt
2024-08-08 7:35 ` [PATCH v2 3/8] builtin/clone: propagate ref storage format to submodules Patrick Steinhardt
2024-08-08 8:03 ` Kristoffer Haugsbakk
2024-08-08 13:29 ` Patrick Steinhardt
2024-08-08 7:35 ` [PATCH v2 4/8] refs: fix ref storage format for submodule ref stores Patrick Steinhardt
2024-08-08 7:35 ` [PATCH v2 5/8] builtin/submodule: allow "add" to use different ref storage format Patrick Steinhardt
2024-08-08 7:35 ` [PATCH v2 6/8] submodule: fix leaking fetch tasks Patrick Steinhardt
2024-08-08 7:35 ` [PATCH v2 7/8] submodule: fix leaking seen submodule names Patrick Steinhardt
2024-08-08 7:36 ` [PATCH v2 8/8] object: fix leaking packfiles when closing object store Patrick Steinhardt
2024-08-08 16:24 ` [PATCH v2 0/8] Improvements for ref storage formats with submodules Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZrMkje9VugtKz-gB@tanuki \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=joland@gmail.com \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).