I was on the fence about whether I should do this or hand-roll my own checkout code when I first built Grouse. Since then:
I received a report that v0.1.0 had a bug where it never closed file descriptors (i.e. I got stung by assuming that implementing my own checkout code would be simple, and it's never as simple as you expect) which caused checkouts of large repos to fail
I've received a report (#2) that Grouse doesn't work with Hugo repos that use GitInfo (because the destination that Grouse's checkout mechanism uses isn't a git repo, it's just a file tree on temp disk storage).
That code was also super fiddly and hard to get right, and is badly tested? So with the benefit of hindsight, I'm inclined to try and replace it with the simpler solution.
Something important to check here: not all git versions support multiple worktrees, and there's a big scary warning in the worktree docs saying:
Multiple checkout in general is still experimental, and the support for submodules is incomplete. It is NOT recommended to make multiple checkouts of a superproject.
I was on the fence about whether I should do this or hand-roll my own checkout code when I first built Grouse. Since then:
That code was also super fiddly and hard to get right, and is badly tested? So with the benefit of hindsight, I'm inclined to try and replace it with the simpler solution.
Something important to check here: not all
git
versions support multiple worktrees, and there's a big scary warning in the worktree docs saying:I wish the author had written why 😅 But it looks like a few brave souls have figured out exactly what the underlying issues are
So, steps for this task:
git
supportworktree add
with submodules.Then, once those investigative tasks are done:
git worktree
for checkouts.