On Wed, Jan 26, 2022 at 6:00 AM Phillip Wood <phillip.wood123@xxxxxxxxx> wrote: > On 25/01/2022 23:59, Elijah Newren wrote: > > There's nothing wrong with running checkout from a subdirectory. It > > is unfortunate that setup.c auto-discovers both the git directory and > > the working tree, but sets GIT_DIR without setting GIT_WORK_TREE in > > the case of a non-main worktree; it's not particularly friendly for > > subcommands. Of course, it's also unfortunate that sequencer still > > forks subprocesses other than those requested by a user with e.g. > > --exec. > > > > But, anyway, I've got a patch that I'll send as soon as it passes CI > > (https://github.com/git/git/pull/1205). > > The patch hasn't come through to me on the mailing list yet, but it > looks good. I thought we set both GIT_DIR and GIT_WORK_TREE when we were > in a non-main worktree but obviously we don't. Eric do you happen to > know if that is intentional? As far as I know, there is no reason to set GIT_DIR and GIT_WORK_TREE, in general, when in a linked worktree since each worktree has its own .git file ("gitfile") which tells Git commands where the repository is and signals that that directory itself (which contains the .git file) is indeed a Git worktree.