Skip to content

Commit ba1bdcd

Browse files
authored
send button becomes non-responsive in existing workspaces after enabling parent repository customizations (#306153)
* send button becomes non-responsive in existing workspaces after enabling parent repository customizations * update * update
1 parent 68cb518 commit ba1bdcd

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ export class PromptFilesLocator {
111111
private async findParentRepoFolders(folderUri: URI, userHome: URI, seen: ResourceSet, logger?: Logger): Promise<URI[]> {
112112
const candidates: URI[] = [];
113113
let current = folderUri;
114-
let parent = dirname(current);
115-
do {
114+
while (true) {
116115
try {
117116
const isRepoRoot = await this.fileService.exists(joinPath(current, '.git'));
118117
if (isRepoRoot) {
@@ -129,9 +128,15 @@ export class PromptFilesLocator {
129128
return []; // if we can't access the folder, return an empty list to avoid treating it as a non-repository when we might just have a permission issue
130129
}
131130
candidates.push(current);
131+
const parent = dirname(current);
132+
// Stop walking up when we reach a filesystem root (fixed-point
133+
// of dirname, e.g. '/' or a Windows drive root like 'D:\'),
134+
// the user home directory, or an already-seen folder.
135+
if (isEqual(current, parent) || current.path === '/' || isEqual(userHome, parent) || seen.has(parent)) {
136+
break;
137+
}
132138
current = parent;
133-
parent = dirname(current);
134-
} while (!seen.has(current) && current.path !== '/' && !isEqual(userHome, current));
139+
}
135140
// no repo found
136141
logger?.logInfo(`No repository root found for folder ${folderUri.toString()}.`);
137142
return [];

0 commit comments

Comments
 (0)