Skip to content

Fix clone detection and add cross-repo safety gate#3

Open
akirayamamoto wants to merge 2 commits intomainfrom
fix/clone-detection-and-cross-repo-gate
Open

Fix clone detection and add cross-repo safety gate#3
akirayamamoto wants to merge 2 commits intomainfrom
fix/clone-detection-and-cross-repo-gate

Conversation

@akirayamamoto
Copy link
Copy Markdown
Collaborator

@akirayamamoto akirayamamoto commented Apr 9, 2026

Summary

  • Prevent file copying during git clone (was incorrectly triggered because clone sends the same all-zeros prev_ref as worktree creation)
  • Prevent cross-repo file copying when GIT_WORKTREE_SOURCE points to a different repository
  • Handle edge case where repo lives in a filesystem path containing "worktrees"

Test plan

  • uvx pytest tests/ -v — all 15 tests pass (3 new)

🤖 Generated with Claude Code

akirayamamoto and others added 2 commits April 10, 2026 05:28
Replace /worktrees/ substring check with GIT_DIR vs GIT_COMMON_DIR
comparison for clone detection. Add hard gate to prevent cross-repo
file copying. Add automated tests for both scenarios.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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