From afc0170e62720a075d8a2a1b99cb636091b1c48f Mon Sep 17 00:00:00 2001 From: lmoresi Date: Wed, 22 Apr 2026 09:24:18 +1000 Subject: [PATCH 1/2] Copy .petsc-version to new worktrees 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) --- uw | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/uw b/uw index eebb537fe..f8e241f36 100755 --- a/uw +++ b/uw @@ -1164,6 +1164,14 @@ worktree_create() { echo -e " ${GREEN}✓${NC} petsc-custom/petsc → main repo (shared)" fi + # .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. + if [ -f "$main_repo/petsc-custom/.petsc-version" ]; then + cp "$main_repo/petsc-custom/.petsc-version" "$wt_path/petsc-custom/.petsc-version" + echo -e " ${GREEN}✓${NC} .petsc-version copied ($(cat "$main_repo/petsc-custom/.petsc-version"))" + fi + # .pixi-env — copy so ./uw knows which environment to use if [ -f "$main_repo/.pixi-env" ]; then cp "$main_repo/.pixi-env" "$wt_path/.pixi-env" From 9dd52c4e713827377d86dda6f10a3777dfbd5be3 Mon Sep 17 00:00:00 2001 From: lmoresi Date: Wed, 22 Apr 2026 15:49:09 +1000 Subject: [PATCH 2/2] Clarify .petsc-version comment: shared source tree limitation 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) --- uw | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/uw b/uw index f8e241f36..00abd5d8a 100755 --- a/uw +++ b/uw @@ -1164,9 +1164,11 @@ worktree_create() { echo -e " ${GREEN}✓${NC} petsc-custom/petsc → main repo (shared)" fi - # .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 select a + # different already-built PETSC_ARCH (e.g. petsc-324-uw-openmpi vs + # petsc-325-uw-openmpi). Built arch directories coexist in the + # shared PETSc source tree; .petsc-version just picks which one + # the activation script uses for PETSC_ARCH. if [ -f "$main_repo/petsc-custom/.petsc-version" ]; then cp "$main_repo/petsc-custom/.petsc-version" "$wt_path/petsc-custom/.petsc-version" echo -e " ${GREEN}✓${NC} .petsc-version copied ($(cat "$main_repo/petsc-custom/.petsc-version"))"