mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 22:12:26 +01:00
Git - fix regression related to worktree detection (#256265)
This commit is contained in:
@@ -2755,10 +2755,22 @@ export class Repository {
|
||||
}
|
||||
|
||||
private async getWorktreesFS(): Promise<Worktree[]> {
|
||||
const worktreesPath = path.join(this.repositoryRoot, '.git', 'worktrees');
|
||||
const config = workspace.getConfiguration('git', Uri.file(this.repositoryRoot));
|
||||
const shouldDetectWorktrees = config.get<boolean>('detectWorktrees') === true;
|
||||
|
||||
if (!shouldDetectWorktrees) {
|
||||
this.logger.info('[Git][getWorktreesFS] Worktree detection is disabled, skipping worktree detection');
|
||||
return [];
|
||||
}
|
||||
|
||||
if (this.kind !== 'repository') {
|
||||
this.logger.info('[Git][getWorktreesFS] Either a submodule or a worktree, skipping worktree detection');
|
||||
return [];
|
||||
}
|
||||
|
||||
try {
|
||||
// List all worktree folder names
|
||||
const worktreesPath = path.join(this.repositoryRoot, '.git', 'worktrees');
|
||||
const dirents = await fs.readdir(worktreesPath, { withFileTypes: true });
|
||||
const result: Worktree[] = [];
|
||||
|
||||
@@ -2786,7 +2798,7 @@ export class Repository {
|
||||
return result;
|
||||
}
|
||||
catch (err) {
|
||||
if (/ENOENT/.test(err.message)) {
|
||||
if (/ENOTDIR/.test(err.message)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user