Skip to content

fix(git): stop implicitly linking .claude#3562

Merged
richardsolomou merged 5 commits into
mainfrom
posthog-code/fix-worktree-claude-linking
Jul 20, 2026
Merged

fix(git): stop implicitly linking .claude#3562
richardsolomou merged 5 commits into
mainfrom
posthog-code/fix-worktree-claude-linking

Conversation

@richardsolomou

@richardsolomou richardsolomou commented Jul 18, 2026

Copy link
Copy Markdown
Member

Problem

Worktrees implicitly share the main checkout's writable .claude directory. That leaks task-local state across worktrees and can leave an absolute local symlink staged in the generated checkout.

Changes

  • I made .claude sharing opt-in through .worktreelink while keeping CLAUDE.local.md linked automatically.
  • I changed local exclude matching to compare exact patterns, so a nested entry like **/.claude/worktrees/ cannot mask a missing .claude exclude.

How did you test this?

  • pnpm --filter @posthog/git exec vitest run src/worktree.test.ts src/queries.test.ts (58 passed)
  • pnpm --filter @posthog/git typecheck and pnpm --filter @posthog/git build
  • pnpm --filter @posthog/git test (327 passed; unrelated checkpoint conflict fixture failed)

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

Keep shared Claude configuration opt-in through .worktreelink so worktrees do not mutate the main checkout's agent state.

Generated-By: PostHog Code
Task-Id: 20616cb3-db9d-4833-87fe-8d9bc6f276a9
@trunk-io

trunk-io Bot commented Jul 18, 2026

Copy link
Copy Markdown

😎 Merged manually by @richardsolomou - details.

@greptile-apps greptile-apps Bot 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.

This review was skipped because it would exceed your organization's monthly flex usage limit. Raise the limit in billing settings or wait until the next billing period resets limits.

@github-actions

github-actions Bot commented Jul 18, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit bfb681b.

@richardsolomou
richardsolomou requested a review from a team July 19, 2026 12:16
@posthog

posthog Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Visual changes approved by @richardsolomou — baseline updated in 1144a6e.

View this run in PostHog

1 changed.

posthog Bot and others added 3 commits July 20, 2026 04:16
1 updated
Run: e43a3b55-29a3-4c2b-a915-738c28b25f20

Co-authored-by: richardsolomou <2622273+richardsolomou@users.noreply.github.com>
@richardsolomou
richardsolomou merged commit d0002a5 into main Jul 20, 2026
30 of 31 checks passed
@richardsolomou
richardsolomou deleted the posthog-code/fix-worktree-claude-linking branch July 20, 2026 12:45
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