Skip to content

Commit d9b6722

Browse files
committed
Fix worktree/workspace path compare
1 parent fe73c84 commit d9b6722

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/github/folderRepositoryManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,7 +2450,7 @@ export class FolderRepositoryManager extends Disposable {
24502450
return await PullRequestGitHelper.getBranchNRemoteForPullRequest(this.repository, pullRequest);
24512451
}
24522452

2453-
getWorktreeForBranch(branchName: string): string | undefined {
2453+
getWorktreeForBranch(branchName: string): vscode.Uri | undefined {
24542454
const worktrees = this.repository.state.worktrees;
24552455
if (!worktrees) {
24562456
return undefined;
@@ -2463,7 +2463,7 @@ export class FolderRepositoryManager extends Disposable {
24632463
const ref = wt.ref.startsWith(refsHeadsPrefix) ? wt.ref.substring(refsHeadsPrefix.length) : wt.ref;
24642464
return ref === branchName;
24652465
});
2466-
return worktree?.path;
2466+
return worktree ? vscode.Uri.file(worktree.path) : undefined;
24672467
}
24682468

24692469
async removeWorktree(worktreePath: string): Promise<void> {

src/github/pullRequestReviewCommon.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,12 @@ export namespace PullRequestReviewCommon {
294294
worktreePath?: string;
295295
};
296296

297-
function isWorktreeInWorkspace(worktreePath: string): boolean {
297+
function isWorktreeInWorkspace(worktreePath: vscode.Uri): boolean {
298+
const worktreeFsPath = worktreePath.fsPath;
298299
return !!vscode.workspace.workspaceFolders?.some(folder => {
299300
const folderPath = folder.uri.fsPath;
300-
return folderPath === worktreePath ||
301-
(process.platform === 'win32' && folderPath.toLowerCase() === worktreePath.toLowerCase());
301+
return folderPath === worktreeFsPath ||
302+
(process.platform === 'win32' && folderPath.toLowerCase() === worktreeFsPath.toLowerCase());
302303
});
303304
}
304305

@@ -350,9 +351,9 @@ export namespace PullRequestReviewCommon {
350351
.getConfiguration(PR_SETTINGS_NAMESPACE)
351352
.get<boolean>(`${DEFAULT_DELETION_METHOD}.${SELECT_WORKTREE}`);
352353
actions.push({
353-
label: vscode.l10n.t('Remove worktree {0}', worktreePath),
354+
label: vscode.l10n.t('Remove worktree {0}', worktreePath.fsPath),
354355
type: 'worktree',
355-
worktreePath,
356+
worktreePath: worktreePath.fsPath,
356357
picked: !!preferredWorktreeDeletion,
357358
});
358359
}

0 commit comments

Comments
 (0)