Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

roomote[bot]
Copy link

@roomote roomote bot commented Oct 12, 2025

Related GitHub Issue

Closes: #8628

Roo Code Task Context (Optional)

N/A - This PR was created to address the reported issue.

Description

This PR fixes an issue where shadow git repositories were unintentionally inheriting the user's global init.templateDir configuration, causing unwanted hooks (like pre-commit hooks) to be triggered in the shadow repository.

Key implementation details:

  • Modified initShadowGit() in ShadowCheckpointService.ts to use git init --template= which explicitly prevents any template from being used
  • The empty --template= flag ensures the shadow repository is created without any hooks or templates
  • Added a test to verify that no executable hooks are created in the shadow repository

Test Procedure

How I tested:

  1. Ran the existing test suite: cd src && npx vitest run services/checkpoints/__tests__/ShadowCheckpointService.spec.ts
  2. Added a specific test case does not inherit global init.templateDir when creating shadow git repo to verify the fix
  3. All 31 tests pass successfully

How reviewers can verify:

  1. Check out this branch
  2. Run cd src && npx vitest run services/checkpoints/__tests__/ShadowCheckpointService.spec.ts
  3. Optionally, set up a global template directory with hooks and verify they are not copied to shadow repositories

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.

Screenshots / Videos

N/A - This is a backend fix with no UI changes.

Documentation Updates

  • No documentation updates are required.

The fix is an internal implementation detail that doesn't 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.

Get in Touch

Available via GitHub for any questions about this PR.


Important

Fixes shadow git repositories inheriting global init.templateDir by modifying initShadowGit() to use git init --template= and adds a test to verify no hooks are created.

  • Behavior:
    • Modify initShadowGit() in ShadowCheckpointService.ts to use git init --template= to prevent inheriting global init.templateDir.
    • Ensures no unwanted hooks or templates are copied to shadow repositories.
  • Testing:
    • Add test does not inherit global init.templateDir when creating shadow git repo in ShadowCheckpointService.spec.ts to verify no executable hooks are created.
    • All 31 tests pass successfully.

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

- Modified initShadowGit to use --template= flag when creating shadow repositories
- This prevents unwanted hooks and templates from being copied to shadow repos
- Added test to verify no executable hooks are created from templates
- Fixes #8628
@roomote roomote bot requested review from cte, jr and mrubens as code owners October 12, 2025 16:33
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Oct 12, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 12, 2025
@xverges
Copy link

xverges commented Oct 12, 2025

I confirmed that this fixes the issue + adds unit tests that my #8630 is missing. Closing mine. 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[BUG] initShadowGit can use an unwanted init.templatedir

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.