Re: 'git rev-parse --show-toplevel' errors out with per-worktree configs
- From
- Clement Moyroud <clement.moyroud@gmail.com>
- Date
- Jul 14, 2020, 21:34 UTC
- Message-ID
- <CABXAcUx9ubCi485xoawSERH4pEjAFJcfGbdNiRL7KkwAmFrMsw@mail.gmail.com>
- In-Reply-To
- <CABXAcUzvZgHwsfL8VaevnDeyyce_5sWtd2istA55CgnzFE1Z6A@mail.gmail.com>
Show 22 quoted lines
> > IOW, this works: > > git clone <url> non-bare > > (cd non-bare && git worktree add -b master2 ../wtree1 master) > > (cd wtree1 && git rev-parse --show-toplevel) > > > > This does not: > > git clone -c extensions.worktreeConfig=true <url> bare.git > > (cd bare.git && git worktree add -b master2 ../wtree2 master) > > (cd wtree2 && git rev-parse --show-toplevel) > > > > Sorry, I mixed up my examples. > > This works: > git clone -c extensions.worktreeConfig=true <url> non-bare > (cd non-bare && git worktree add -b master2 ../wtree1 master) > (cd wtree1 && git rev-parse --show-toplevel) > > This does not: > git clone -c extensions.worktreeConfig=true --mirror <url> bare.git > (cd bare.git && git worktree add -b master2 ../wtree2 master) > (cd wtree2 && git rev-parse --show-toplevel)
OK, I figured it out by looking at environment.c. The issue is that the base mirror is bare, but the worktree isn't. This makes it work: (cd wtree2 && git config --worktree core.bare true)
This is confusing - should this be set automatically, or referenced more clearly in the 'Configuration File' section of the git-worktree doc?
Thanks,
Clément