From 23e2d05c87bf0c2ef4f5dfbb513830e37f5b0d1c Mon Sep 17 00:00:00 2001 From: Sebastian Barfurth Date: Tue, 28 Jul 2026 12:38:00 +0000 Subject: [PATCH] Fix copying relative path on non-working copy revision. The `jj` scheme of the resource URI was causing the path not to be relativized correctly. Using the `fsPath` prevents this as it only looks at the file-system path rather than trying to also match the scheme. --- package.json | 20 ++++++++++---------- src/main.ts | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 821a16f3..d2f91065 100644 --- a/package.json +++ b/package.json @@ -224,13 +224,13 @@ "category": "Jujutsu" }, { - "command": "jj.copyPath", - "title": "Copy Path", + "command": "jj.copyRelativePath", + "title": "Copy Relative Path", "category": "Jujutsu" }, { - "command": "jj.copyRelativePath", - "title": "Copy Relative Path", + "command": "jj.copyPath", + "title": "Copy Path", "category": "Jujutsu" } ], @@ -397,14 +397,14 @@ "group": "inline" }, { - "command": "jj.copyPath", + "command": "jj.copyRelativePath", "when": "scmProvider == jj", "group": "1_copypath@1" }, { - "command": "jj.copyRelativePath", + "command": "jj.copyPath", "when": "scmProvider == jj", - "group": "1_copypath@1" + "group": "1_copypath@2" } ], "scm/resourceFolder/context": [ @@ -424,14 +424,14 @@ "group": "inline" }, { - "command": "jj.copyPath", + "command": "jj.copyRelativePath", "when": "scmProvider == jj", "group": "1_copypath@1" }, { - "command": "jj.copyRelativePath", + "command": "jj.copyPath", "when": "scmProvider == jj", - "group": "1_copypath@1" + "group": "1_copypath@2" } ], "commandPalette": [ diff --git a/src/main.ts b/src/main.ts index 8ad91590..abef2b18 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1468,7 +1468,7 @@ export async function activate(context: vscode.ExtensionContext) { 'jj.copyRelativePath', async (resourceState: vscode.SourceControlResourceState) => { await vscode.env.clipboard.writeText( - vscode.workspace.asRelativePath(resourceState.resourceUri), + vscode.workspace.asRelativePath(resourceState.resourceUri.fsPath), ); }, ),