Copy .petsc-version to new worktrees - #128
Conversation
worktree_create symlinks petsc-custom/petsc/ (the build) but not petsc-custom/.petsc-version (the version pin). The activation script needs this file to derive PETSC_ARCH. Without it, worktrees fall back to the default version and ./uw build fails or links against the wrong PETSc. Copy (not symlink) so each worktree can independently pin a different PETSc version via ./uw petsc switch. Underworld development team with AI support from Claude Code (https://claude.com/claude-code)
There was a problem hiding this comment.
Pull request overview
Updates the ./uw worktree create workflow so new worktrees inherit the PETSc version pin used by pixi activation, preventing accidental fallback to the default PETSc arch and incorrect linking during builds.
Changes:
- Copy
petsc-custom/.petsc-versionfrom the main repo into newly created worktrees (copy, not symlink). - Emit a status line showing the copied version.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # .petsc-version — copy (not symlink) so each worktree can pin its own | ||
| # PETSc version independently. Initialised from the main repo's current | ||
| # version; the worktree can later run ./uw petsc switch to diverge. |
There was a problem hiding this comment.
The new comment says the worktree can later run ./uw petsc switch to diverge, but worktree_create symlinks petsc-custom/petsc to the main repo, and ./uw petsc switch ultimately runs build-petsc.sh checkout, which does a git checkout in PETSC_DIR (the shared symlink). That means switching PETSc from a worktree will affect the shared PETSc checkout (and other worktrees). Suggest rewording this comment to avoid implying petsc switch is worktree-local, and clarify that .petsc-version only controls PETSC_ARCH selection across existing builds unless PETSc is unshared.
| # .petsc-version — copy (not symlink) so each worktree can pin its own | |
| # PETSc version independently. Initialised from the main repo's current | |
| # version; the worktree can later run ./uw petsc switch to diverge. | |
| # .petsc-version — copy (not symlink) so each worktree can record its own | |
| # preferred PETSc version string. Initialised from the main repo's current | |
| # version. While petsc-custom/petsc is shared, this only influences | |
| # PETSC_ARCH selection among existing builds; running ./uw petsc switch in | |
| # a worktree will switch the shared PETSc checkout unless PETSc is unshared. |
The PETSc source is symlinked, so ./uw petsc switch in a worktree affects all worktrees. The .petsc-version copy lets worktrees select different already-built arch directories, not independently switch the source checkout. Underworld development team with AI support from Claude Code (https://claude.com/claude-code)
037c238 to
9dd52c4
Compare
Summary
./uw worktree createsymlinkspetsc-custom/petsc/(the build directory) but didn't copypetsc-custom/.petsc-version(the version pin)activate-petsc-arch.sh) reads.petsc-versionto derivePETSC_ARCH-- without it, worktrees fall back to the default and./uw buildlinks against the wrong PETScTest plan
.petsc-versionis presentUnderworld development team with AI support from Claude Code