Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jan 12, 2026

Related GitHub Issue

Closes: #10636

Description

This PR attempts to address Issue #10636 where users opening a parent folder containing multiple sibling projects (e.g., frontend and backend), each with their own independent git repositories, were incorrectly being blocked from using the checkpoint feature.

The Problem:
The getNestedGitRepository() method in ShadowCheckpointService.ts was finding any .git/HEAD files in subdirectories and treating them as nested repositories, without checking if the workspace root itself has a .git directory.

The Solution:
Modified getNestedGitRepository() to:

  1. First check if the workspace root has its own .git directory
  2. If the root does NOT have .git, return null (allow checkpoints) since subdirectory git repos are independent sibling projects, not truly nested
  3. Only continue checking for nested repos when the root HAS a .git directory (true nesting scenario like git submodules)

Why this is safe:

  • The shadow repository creates its own version control in the checkpoints directory (separate from workspace)
  • Subdirectory .git folders are already excluded from tracking via the .git/ pattern in exclude patterns
  • There is no conflict since each project manages its own git independently

This approach maintains backward compatibility:

  • Projects with root .git and nested repos (like git submodules) still see the error
  • Projects without root .git can now use checkpoints regardless of subdirectory git repos

Feedback and guidance are welcome.

Test Procedure

  1. Unit Tests: Added a new test case succeeds when workspace has no root .git but has sibling git repos in subdirectories in ShadowCheckpointService.spec.ts
  2. Manual Testing Steps:
    • Create a parent folder without .git
    • Inside, clone two separate git repositories (e.g., frontend and backend)
    • Open the parent folder in VS Code with Roo Code
    • Enable checkpoints and verify they work without the nested git repository error

All existing tests pass (32 tests total).

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required.

Additional Notes

This fix specifically targets the scenario described in issue #10636 where users have a monorepo-style setup without a root .git (just a parent folder containing multiple independent git repos).


Important

Fix getNestedGitRepository() to allow checkpoints in workspaces with sibling git repos but no root .git directory.

  • Behavior:
    • Modify getNestedGitRepository() in ShadowCheckpointService.ts to check for root .git directory before treating subdirectory .git folders as nested.
    • If root has no .git, allow checkpoints as subdirectory repos are independent.
  • Tests:
    • Add test succeeds when workspace has no root .git but has sibling git repos in subdirectories in ShadowCheckpointService.spec.ts.
    • Manual testing procedure provided to verify fix.
  • Misc:

This description was created by Ellipsis for 4e9cb4d. You can customize this summary. It will automatically update as commits are pushed.

…g git repos

This fixes issue #10636 where opening a parent folder containing multiple
sibling projects (e.g., frontend and backend) with their own independent
git repositories would incorrectly be detected as "nested" git repositories.

The fix modifies getNestedGitRepository() in ShadowCheckpointService to:
- First check if the workspace root has its own .git directory
- If no root .git exists, return null (allow checkpoints) since subdirectory
  git repos are independent sibling projects, not truly nested
- Only continue checking for nested repos when root HAS .git (true nesting)

Also adds a test case to verify this scenario works correctly.
@roomote
Copy link
Contributor Author

roomote bot commented Jan 12, 2026

Rooviewer Clock   See task on Roo Cloud

Reviewed the changes and found no issues. The implementation correctly addresses issue #10636 by checking if the workspace root has a .git directory before detecting nested git repos. The logic, safety considerations, and test coverage are all appropriate.

  • No issues found

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

Nested git repository detected, cannot use checkpoint feature

3 participants