Is there a way to determine the "main" worktree (i.e. the one with a .git directory) by running a command in any worktree? This does not work:
git rev-parse --show-toplevel
The best I can think of is parsing git worktree list --porcelain, and then testing if there is a .git directory in each one. That seems a bit naff though. Does Git have a built in command to do this?