feat(source-control): add copy relative path#9018
Open
kenfdev wants to merge 1 commit into
Open
Conversation
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe source control context menu now accepts an optional relative path and adds a “Copy Relative Path” action that writes it to the clipboard when available. Both uncommitted and branch entries pass their relative paths to the menu. A new test suite verifies that selecting the action copies the expected path. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
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.
Summary
Adds “Copy Relative Path” to the Source Control file context menu, directly below the existing “Copy Path” command.
The command copies the path of the row whose context menu was opened, relative to the worktree root. It intentionally preserves the existing single-row behavior of “Copy Path” and does not change multi-selection behavior.
Closes #9017
Screenshots
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildThe full test suite completed with 29,963 passing tests, 42 skipped tests, and two failures unrelated to this change:
miseexecutable instead of the currentmise-managed Node executable in this local environment.The focused Source Control context-menu regression test passes.
AI Review Report
The AI coding agent reviewed the implementation and regression test for:
The review confirmed that the command copies the existing Git-relative
entry.pathwithout local filesystem conversion. This keeps the behavior consistent across macOS, Linux, Windows, WSL, and SSH environments.A standalone React Doctor scan reported existing diagnostics in the large
SourceControl.tsxcomponent. None related to this change; the repository’s changed-file React Doctor gate passed. No implementation changes were required as a result.The review explicitly checked cross-platform compatibility. This PR does not add or change keyboard shortcuts, shortcut labels, shell commands, filesystem operations, or Electron platform-specific behavior. It only passes an existing Git-relative path string to the existing clipboard API.
Security Audit
The AI coding agent reviewed the change for input handling, command execution, path handling, authentication, secrets, dependencies, and IPC risks.
window.api.ui.writeClipboardTextAPI already used by “Copy Path.”No security follow-up is needed.
Notes