fix: prevent shadow git from inheriting global init.templateDir#11630
Draft
roomote[bot] wants to merge 1 commit intomainfrom
Draft
fix: prevent shadow git from inheriting global init.templateDir#11630roomote[bot] wants to merge 1 commit intomainfrom
roomote[bot] wants to merge 1 commit intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: #8628
Roo Code Task Context (Optional)
Rebased version of #8629, which was closed due to inactivity but is still relevant per community feedback.
Description
This PR fixes an issue where shadow git repositories unintentionally inherit the user's global
init.templateDirconfiguration, causing unwanted hooks (like pre-commit hooks) to be triggered in the shadow repository.Key implementation details:
createSanitizedGit()inShadowCheckpointService.tsto strip theGIT_TEMPLATE_DIRenvironment variable, preventing it from leaking into the shadow git environmentinitShadowGit()to usegit init --template=which explicitly prevents any template from being used during shadow repo initializationTest Procedure
How I tested:
cd src && npx vitest run services/checkpoints/__tests__/ShadowCheckpointService.spec.tsdoes not apply git templates when initializing shadow repoto verify the fixHow reviewers can verify:
cd src && npx vitest run services/checkpoints/__tests__/ShadowCheckpointService.spec.tsPre-Submission Checklist
Screenshots / Videos
N/A - This is a backend fix with no UI changes.
Documentation Updates
The fix is an internal implementation detail that does not affect the public API or user-facing functionality.
Additional Notes
This is a targeted fix that prevents potential security issues and unexpected behavior when users have pre-commit hooks or other git templates configured globally. The shadow repository should be isolated from user configurations to ensure consistent behavior. This is a rebased version of #8629 applied cleanly on top of current main.
Get in Touch
Available via GitHub for any questions about this PR.
View task on Roo Code Cloud
Start a new Roo Code Cloud session on this branch