Re: [Bug] Rebase from worktree subdir is broken (was Re: [PATCH v5 07/11] rebase: do not attempt to remove startup_info->original_cwd)
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Jan 27, 2022, 11:01 UTC
- Message-ID
- <b56c8855-df66-4e6d-6bc8-01cd06dd0feb@gmail.com>
- In-Reply-To
- <CAPig+cQVNdmHQnhORqh2XtJSMhcOymR99pmKTWOAyhoQ10khSw@mail.gmail.com>
On 26/01/2022 17:53, Eric Sunshine wrote:
Show 23 quoted lines
> On Wed, Jan 26, 2022 at 6:00 AM Phillip Wood <phillip.wood123@gmail.com> 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.Oh of course I should have thought of that. Now I'm wondering why we're exporting GIT_DIR - I should go and read the code for myself.
Thanks
Phillip