All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Ratiu <adrian.ratiu@collabora.com>
To: Andreas Wendleder <gonsolo@gmail.com>, git@vger.kernel.org
Cc: Phillip Wood <phillip.wood123@gmail.com>
Subject: Re: submodule: linked-worktree submodule hits BUG() in validate_submodule_legacy_git_dir()
Date: Tue, 17 Nov 2026 19:45:24 +0200	[thread overview]
Message-ID: <877bibjqrv.fsf@collabora.com> (raw)
In-Reply-To: <avuJBGlB3pRU3JU0@pampelmuse>

Hi Andreas,

On Mon, 16 Nov 2026, Andreas Wendleder <gonsolo@gmail.com> wrote:
> With submodule.recurse=true, switching branches in a superproject worktree
> whose submodule is itself a linked worktree of the submodule repository
> aborts:
>
>   BUG: submodule.c:2414: submodule name 'sub' not a suffix of git dir
>   '.../.git/modules/sub/worktrees/sub1'

Thanks for reporting this and for the reproducer.

The BUG() is older than submodulePathConfig. Users could not reach it
before 9cf8547320 (clone: prevent clashing git dirs when cloning
submodule in parallel, 2024-01-28), which made submodule_move_head()
validate whatever path the submodule's gitfile points to. A path read
from disk can be anything, so it should never hit a BUG().

Your reproducer needs the second worktree because the gitdir ".../sub"
happens to end in the submodule name, so the check passes by accident.

t2405 sets up exactly this layout but never runs a recursvie checkout.

I'll send a fix.

> With extensions.submodulePathConfig enabled (repositoryformatversion 1),
> the same commands no longer crash but die with the "refusing to create/use
> ..." message, which recommends enabling the extension that is already
> enabled.
>
> I would expect a linked worktree of a submodule's repository to be
> accepted as the submodule's git dir. If it is meant to be rejected, the
> legacy path should return an error instead of calling BUG(), and the hint
> should not suggest the extension when it is already on.

Yes, the hint is actually my mistake.

I have a local fix which I need to test a bit more, but makes your
script switch cleanly in both modes and the main submodule checkout
isn't touched.

Will send it in the next few days with you in Reported-by.

Thanks again,
Adrian

      reply	other threads:[~2026-11-17 17:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 22:51 submodule: linked-worktree submodule hits BUG() in validate_submodule_legacy_git_dir() Andreas Wendleder
2026-11-17 17:45 ` Adrian Ratiu [this message]

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=877bibjqrv.fsf@collabora.com \
    --to=adrian.ratiu@collabora.com \
    --cc=git@vger.kernel.org \
    --cc=gonsolo@gmail.com \
    --cc=phillip.wood123@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.