fix: allow checkpoints when workspace has sibling git repos without root .git #10637
+77
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 inShadowCheckpointService.tswas finding any.git/HEADfiles in subdirectories and treating them as nested repositories, without checking if the workspace root itself has a.gitdirectory.The Solution:
Modified
getNestedGitRepository()to:.gitdirectory.git, returnnull(allow checkpoints) since subdirectory git repos are independent sibling projects, not truly nested.gitdirectory (true nesting scenario like git submodules)Why this is safe:
.gitfolders are already excluded from tracking via the.git/pattern in exclude patternsThis approach maintains backward compatibility:
.gitand nested repos (like git submodules) still see the error.gitcan now use checkpoints regardless of subdirectory git reposFeedback and guidance are welcome.
Test Procedure
succeeds when workspace has no root .git but has sibling git repos in subdirectoriesinShadowCheckpointService.spec.ts.gitAll existing tests pass (32 tests total).
Pre-Submission Checklist
Documentation Updates
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.gitdirectory.getNestedGitRepository()inShadowCheckpointService.tsto check for root.gitdirectory before treating subdirectory.gitfolders as nested..git, allow checkpoints as subdirectory repos are independent.succeeds when workspace has no root .git but has sibling git repos in subdirectoriesinShadowCheckpointService.spec.ts.This description was created by
for 4e9cb4d. You can customize this summary. It will automatically update as commits are pushed.