Re: Regression: submodule worktrees can clobber core.worktree config
- Date: Wed, 9 Jan 2019 07:40:04 +0100
- From: Tomasz Śniatowski <tsniatowski@xxxxxxxx>
- Subject: Re: Regression: submodule worktrees can clobber core.worktree config
On Wed, 9 Jan 2019 at 00:23, Duy Nguyen <pclouds@xxxxxxxxx> wrote:
> On Wed, Jan 9, 2019 at 5:56 AM Tomasz Śniatowski <tsniatowski@xxxxxxxx> wrote:
> > After upgrading to 2.20.1 I noticed in some submodule+worktree scenarios git
> > will break the submodule configuration. Reproducible with:
> > git init a && (cd a; touch a; git add a; git commit -ma)
> > git init b && (cd b; git submodule add ../a; git commit -mb)
> > git -C b worktree add ../b2
> > git -C b/a worktree add ../../b2/a
> > git -C b status
> > git -C b2 submodule update
> > git -C b status
> > The submodule update in the _worktree_ puts an invalid core.worktree value in
> > the _original_ repository submodule config (b/.git/modules/a/config), causing
> > the last git status to error out with:
> > fatal: cannot chdir to '../../../../../../b2/a': No such file or directory
> > fatal: 'git status --porcelain=2' failed in submodule a
> > Looking at the config file itself, the submodule update operation applies the
> > following change (the new path is invalid):
> > - worktree = ../../../a
> > + worktree = ../../../../../../b2/a
> > This worked fine on 2.19.2 (no config change, no error), and was useful to have
> > a worktree with (large) submodules that are also worktrees.
> This scenario is not supported (or at least known to be broken in
> theory) so I wouldn't call this a regression even if it happens to
> work on 2.19.2 for some reason.
This scenario worked fine for quite a while now, at least since around 2.15
(as I started using this early 2018). It "just worked", to be honest, just
needed the worktree submodules to be manually set up as worktrees too.
> The good news is, I have something that should make it work reliably.
> But I don't know if it will make it to 2.21 or not.
That's good to hear, is there something I can try out or track?