Skip to content

Commit 0bce433

Browse files
committed
CCR feedback
1 parent 1e17911 commit 0bce433

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/gitProviders/vslsguest.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as vscode from 'vscode';
77

88
import { LiveShare, SharedServiceProxy } from 'vsls/vscode.js';
9-
import { Branch, Change, Commit, Ref, Remote, RepositoryState, Submodule } from '../@types/git';
9+
import { Branch, Change, Commit, Ref, Remote, RepositoryState, Submodule, Worktree } from '../@types/git';
1010
import { IGit, Repository } from '../api/api';
1111
import { Disposable } from '../common/lifecycle';
1212
import {
@@ -138,6 +138,7 @@ class LiveShareRepositoryState implements RepositoryState {
138138
HEAD: Branch | undefined;
139139
remotes: Remote[];
140140
submodules: Submodule[] = [];
141+
worktrees: Worktree[] = [];
141142
rebaseCommit: Commit | undefined;
142143
mergeChanges: Change[] = [];
143144
indexChanges: Change[] = [];

src/github/folderRepositoryManager.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ import {
4646
CHAT_SETTINGS_NAMESPACE,
4747
CHECKOUT_DEFAULT_BRANCH,
4848
CHECKOUT_PULL_REQUEST_BASE_BRANCH,
49+
DEFAULT_DELETION_METHOD,
4950
DISABLE_AI_FEATURES,
5051
GIT,
5152
POST_DONE,
5253
PR_SETTINGS_NAMESPACE,
5354
PULL_BEFORE_CHECKOUT,
5455
PULL_BRANCH,
5556
REMOTES,
57+
SELECT_WORKTREE,
5658
UPSTREAM_REMOTE,
5759
} from '../common/settingKeys';
5860
import { ITelemetry } from '../common/telemetry';
@@ -2193,14 +2195,20 @@ export class FolderRepositoryManager extends Disposable {
21932195
nonExistantBranches = new Set<string>();
21942196

21952197
// Find which selected branches have worktrees (must be deleted before the branch)
2198+
const preferredWorktreeDeletion = !!vscode.workspace
2199+
.getConfiguration(PR_SETTINGS_NAMESPACE)
2200+
.get<boolean>(`${DEFAULT_DELETION_METHOD}.${SELECT_WORKTREE}`);
21962201
const worktreeItems: (vscode.QuickPickItem & { worktreePath: string })[] = [];
21972202
for (const pick of branchPicks) {
21982203
const worktreeUri = this.getWorktreeForBranch(pick.label);
2199-
if (worktreeUri) {
2204+
if (worktreeUri && !vscode.workspace.workspaceFolders?.some(folder =>
2205+
folder.uri.fsPath === worktreeUri.fsPath ||
2206+
(process.platform === 'win32' && folder.uri.fsPath.toLowerCase() === worktreeUri.fsPath.toLowerCase())
2207+
)) {
22002208
worktreeItems.push({
22012209
label: pick.label,
22022210
description: worktreeUri.fsPath,
2203-
picked: true,
2211+
picked: preferredWorktreeDeletion,
22042212
worktreePath: worktreeUri.fsPath,
22052213
});
22062214
}

0 commit comments

Comments
 (0)