fix: preserve symlink target when source is parent#46
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA one-line fix normalizes empty relative paths to Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
There was a problem hiding this comment.
Pull request overview
Fixes symlink target generation in applyTargetDir so that when the computed relative target is an empty string (i.e., sourceDir === dirname(targetDir)), it normalizes to "." to avoid creating unusable symlinks. Adds a regression test to ensure the symlink both works (can read a file through it) and preserves the expected link target.
Changes:
- Normalize non-Windows symlink targets from
path.relative(...)topath.relative(...) || "."to handle the empty-string case. - Add a regression test covering
sourceDir === dirname(targetDir)and asserting both symlink usability andreadlink()target value.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/targets.test.js | Adds regression coverage for the “source is target parent” symlink case. |
| src/cache/targets.ts | Normalizes empty relative symlink targets to "." on non-Windows platforms. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
applyTargetDirsymlink mode to normalize empty relative targets ("") to".".sourceDir === dirname(targetDir)to assert symlink usability and link target.Testing
pnpm build && pnpm testSummary by CodeRabbit
Bug Fixes
Tests