Skip to content

fix(worktree): copy .envrcs/.env.* dotenv fragments into new worktrees - #138

Merged
dlovell merged 1 commit into
mainfrom
fix/worktree-copy-dotenv-fragments
Aug 7, 2026
Merged

fix(worktree): copy .envrcs/.env.* dotenv fragments into new worktrees#138
dlovell merged 1 commit into
mainfrom
fix/worktree-copy-dotenv-fragments

Conversation

@dlovell

@dlovell dlovell commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Problem

projects/devcontainer/worktree-copies.txt copied .envrcs/.envrc.user into a
new worktree but not the dotenv fragments a .envrc.user loads with
dotenv_if_exists (e.g. .envrcs/.env.user.devcontainer). The worktree got the
direnv fragment and then sourced a file that wasn't there — silently, because
_if_exists doesn't complain — so those vars were simply absent in every new
worktree.

Fix

Add .envrcs/.env.* to the overlay's copy list. projects/xorq/ and
projects/xorq-desktop/ already carry exactly this line; the devcontainer
overlay was the copy that didn't get it — the "guarded, but too narrowly for a
copy that propagates" class in CLAUDE.md's Conventions.

The pattern does not re-match .envrc.* (the 5th character there is r, not
.), so nothing already on the list changes behaviour. Verified against a real
nullglob expansion in the main checkout: it matches
.envrcs/.env.user.devcontainer and nothing else.

Notes

  • No issue to close; found while using new-worktree.
  • Existing worktrees aren't retroactively fixed — setup-worktree only creates
    what's missing, so re-running it (or devcontainer up) in an existing
    worktree picks the file up.
  • projects/xorq-style/ has the same omission and is deliberately left out of
    scope here.

🤖 Generated with Claude Code

The devcontainer overlay copied .envrcs/.envrc.user into a new worktree but
not the dotenv fragments a .envrc.user loads with `dotenv_if_exists`, so the
worktree sourced a file that wasn't there and lost those vars silently.

projects/xorq/ and projects/xorq-desktop/ already list `.envrcs/.env.*` for
exactly this; the pattern doesn't re-match `.envrc.*`, so nothing already
copied changes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@dlovell
dlovell merged commit a968114 into main Aug 7, 2026
3 checks passed
@dlovell
dlovell deleted the fix/worktree-copy-dotenv-fragments branch August 7, 2026 18:04
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.

1 participant