Git - tweak copilot worktree folder detection (#299147)

* Git - tweak copilot worktree folder detection

* Pull request feedback
This commit is contained in:
Ladislau Szomoru
2026-03-04 09:58:25 +01:00
committed by GitHub
parent b5a312a098
commit 4ff01e687e
3 changed files with 8 additions and 14 deletions

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Event, Disposable, EventEmitter, SourceControlHistoryItemRef, l10n, workspace, Uri, DiagnosticSeverity, env, SourceControlHistoryItem } from 'vscode';
import { dirname, normalize, sep, relative } from 'path';
import { basename, dirname, normalize, sep, relative } from 'path';
import { Readable } from 'stream';
import { promises as fs, createReadStream } from 'fs';
import byline from 'byline';
@@ -867,12 +867,6 @@ export function getStashDescription(stash: Stash): string | undefined {
return descriptionSegments.join(' \u2022 ');
}
export const CopilotWorktreeBranchPrefix = 'copilot-worktree-';
export function isCopilotWorktree(path: string): boolean {
const lastSepIndex = path.lastIndexOf(sep);
return lastSepIndex !== -1
? path.substring(lastSepIndex + 1).startsWith(CopilotWorktreeBranchPrefix)
: path.startsWith(CopilotWorktreeBranchPrefix);
export function isCopilotWorktreeFolder(path: string): boolean {
return basename(path).startsWith('copilot-');
}