bootstrap: Improve the UX when run from a git worktree
It should look something like this behind the scenes:
$ x.py setup --worktree ../rustc2
Setting up a new worktree at `/home/joshua/rustc2` # runs `git worktree add ../rustc2`
# all the current prompts, but config.toml is written to rustc2 instead of the current directory
# does *not* suggest to set up a git hook
This would make https://rustc-dev-guide.rust-lang.org/building/suggested.html?highlight=worktree#working-on-multiple-branches-at-the-same-time a lot more discoverable.
It should also use the submodule suggestions from https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/script.20to.20quickly.20generate.20complete.20git.20worktree (cc @lzutao), which would prevent cloning llvm more than once.
This would help work around https://github.com/rust-lang/rust/issues/77620.
it would be nice if bootstrap could auto-detect when it's being run from a git worktree and share
- the git submodule history, so it doesn't have to be refetched from the network https://github.com/rust-lang/rust/issues/77621#issuecomment-1596970050
- the config.toml from the original worktree https://github.com/rust-lang/rust/issues/77621#issuecomment-1596967245
It should look something like this behind the scenes:
$ x.py setup --worktree ../rustc2 Setting up a new worktree at `/home/joshua/rustc2` # runs `git worktree add ../rustc2` # all the current prompts, but config.toml is written to rustc2 instead of the current directory # does *not* suggest to set up a git hookThis would make https://rustc-dev-guide.rust-lang.org/building/suggested.html?highlight=worktree#working-on-multiple-branches-at-the-same-time a lot more discoverable.
It should also use the submodule suggestions from https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/script.20to.20quickly.20generate.20complete.20git.20worktree (cc @lzutao), which would prevent cloning llvm more than once.
This would help work around https://github.com/rust-lang/rust/issues/77620.
</details>jyn at 2023-06-19 11:00:29
This could also suggest to copy over the existing
config.tomlas one of theprofilechoices.jyn at 2020-10-12 21:29:15
This could also suggest to copy over the existing
config.tomlas one of theprofilechoices.i think this is good and useful, but rather than making it opt-in with --worktree, we should do it automatically when we detect the current git checkout is in a worktree:
(bash@pop-os) ~/src/rust2 ; file $(git worktree list | grep -v ~/src/rust2 | head -n1 | awk '{print $1}')/config.toml /home/jyn/src/rust/config.toml: ASCII text, with very long lines (634)jyn at 2023-06-19 10:49:49
actually
rather than adding an extra step, we could fall back to the config.toml of the primary worktree if it doesn't exist in the current worktree. it's a little more implicit, but it seems like a more useful behavior, and it will always get overridden if someone's already made a config.toml.
jyn at 2023-06-19 10:56:54
rather than adding an extra step, we could fall back to the config.toml of the primary worktree if it doesn't exist in the current worktree. it's a little more implicit, but it seems like a more useful behavior, and it will always get overridden if someone's already made a config.toml.
we could do something similar for checking out submodules so we don't have to re-fetch the history in each worktree
jyn at 2023-06-19 10:58:39