Skip to content

fix: resolve file compare paths against the git root - #7

Open
jamin-peckham-sp wants to merge 1 commit into
Nimblesite:mainfrom
jamin-peckham-sp:fix/repo-relative-path-for-file-compare
Open

fix: resolve file compare paths against the git root#7
jamin-peckham-sp wants to merge 1 commit into
Nimblesite:mainfrom
jamin-peckham-sp:fix/repo-relative-path-for-file-compare

Conversation

@jamin-peckham-sp

Copy link
Copy Markdown

Summary

  • File-level Compare with Commit/Branch/Tag used vscode.workspace.asRelativePath, which is relative to the workspace folder, then joined that path onto the git repository root.
  • When the workspace folder is a subdirectory of the repo (common with nested packages), the working-copy side of the diff opened the wrong absolute path.
  • Paths are now computed with toRepoRelPath (path.relative to the git root), with unit coverage for the nested-workspace case.

Test plan

  • make test (unit + E2E + coverage threshold)
  • Manual: installed local VSIX in Cursor (WSL), opened a nested workspace under a git root, right-click file → Diffr: Compare with Commit… / Compare with Branch… → working-copy URI matches the real file path
  • Reviewer: smoke the same flow when workspace folder === git root (existing E2E covers this)

Made with Cursor

vscode.workspace.asRelativePath is workspace-folder relative, so nested
workspace folders produced wrong working-copy URIs for Compare with
Commit/Branch/Tag. Use path.relative to the git repository root instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant