Re: GIT_DIR output from git worktree list
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Dec 13, 2020, 06:07 UTC
- Message-ID
- <CAPig+cRZ-018Krj2fGq0hx5qNptW8qUiwhkws8ixvk242Z_b0g@mail.gmail.com>
- In-Reply-To
- <CACsJy8Dq9Lz1YkkqvR0Fa1PLUBJhNJTmLtnRssi=DDpWAQTWww@mail.gmail.com>
On Wed, Dec 9, 2020 at 4:31 AM Duy Nguyen <pclouds@gmail.com> wrote:
Show 12 quoted lines
> On Wed, Dec 9, 2020 at 2:27 AM Eric Sunshine <sunshine@sunshineco.com> wrote: > > What I was suggesting was that it might be the case that the only way > > to solve this would be to store the location of the main worktree > > somewhere within <repo> in some file, and then `git worktree list` > > would consult that file to learn the location of the main worktree. > > Not that it matters because I don't do Git anymore. But when I was > doing this I imagined unify main and secondary worktrees. When you > switch from single to multiple worktrees, there is no main worktree > anymore. The place that is main worktree still has your files, but it > has the same status and treatment as any other worktree. And the repo > is tucked away somewhere safe.
I had some vague thoughts along those lines, as well, but such a change is outside the scope of my limited time these days.
Superficially, the idea I expressed above, of storing the path of the main worktree in some file within the repository (let's say `.git/mainworktreepath`) doesn't seem like it should be too difficult (though I haven't really thought it through). And, if the main worktree does get moved, the file could be fixed up or kept up-to-date by the `git worktree repair` command.
(By the way, thanks for responding. It's nice to hear from you again after your long absence.)