Skip to content

Copy .petsc-version to new worktrees - #128

Merged
lmoresi merged 2 commits into
developmentfrom
bugfix/worktree-petsc-version
Apr 22, 2026
Merged

lmoresi merged 2 commits into
developmentfrom
bugfix/worktree-petsc-version

Conversation

@lmoresi

@lmoresi lmoresi commented Apr 21, 2026

Copy link
Copy Markdown
Member

Summary

  • ./uw worktree create symlinks petsc-custom/petsc/ (the build directory) but didn't copy petsc-custom/.petsc-version (the version pin)
  • The pixi activation script (activate-petsc-arch.sh) reads .petsc-version to derive PETSC_ARCH -- without it, worktrees fall back to the default and ./uw build links against the wrong PETSc
  • Fix: copy the file (not symlink) so each worktree can independently pin a different PETSc version

Test plan

  • Verified the file is missing in existing worktrees
  • Create a new worktree and confirm .petsc-version is present

Underworld development team with AI support from Claude Code

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)
Copilot AI review requested due to automatic review settings April 21, 2026 23:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-version from 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.

Comment thread uw Outdated
Comment on lines +1167 to +1169
# .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.

Copilot AI Apr 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# .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.

Copilot uses AI. Check for mistakes.
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)
@lmoresi
lmoresi force-pushed the bugfix/worktree-petsc-version branch from 037c238 to 9dd52c4 Compare April 22, 2026 05:50
@lmoresi
lmoresi merged commit f8f06f0 into development Apr 22, 2026
1 check passed
@lmoresi
lmoresi deleted the bugfix/worktree-petsc-version branch June 13, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants