Skip to content

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

Open
richardsolomou wants to merge 1 commit into
mainfrom
posthog-code/fix-worktree-claude-linking
Open

fix(git): stop implicitly linking .claude#3562
richardsolomou wants to merge 1 commit 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

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@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

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 63d394d.

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