Session window: apply patch to local

This commit is contained in:
Osvaldo Ortega
2026-03-03 08:28:10 -08:00
parent 83601ca509
commit dd8539f530
3 changed files with 71 additions and 34 deletions

View File

@@ -1061,6 +1061,20 @@ export class CommandCenter {
await repo.pull();
}
@command('_git.applyPatch')
async applyPatch(repositoryPath: string, patchContent: string): Promise<void> {
const dotGit = await this.git.getRepositoryDotGit(repositoryPath);
const repo = new GitRepository(this.git, repositoryPath, undefined, dotGit, this.logger);
const patchPath = path.join(os.tmpdir(), `vscode-patch-${Date.now()}.patch`);
const { promises: fsp } = await import('fs');
try {
await fsp.writeFile(patchPath, patchContent, 'utf8');
await repo.apply(patchPath, { threeWay: true });
} finally {
await fsp.unlink(patchPath).catch(() => { });
}
}
@command('git.init')
async init(skipFolderPrompt = false): Promise<void> {
let repositoryPath: string | undefined = undefined;