From 466bb876a6cff5eff732f29f50fa44c7e2e28fc8 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Fri, 19 Jul 2024 09:26:50 +0200 Subject: [PATCH] Git - update terminal shell integration (#222155) --- extensions/git/src/terminal.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extensions/git/src/terminal.ts b/extensions/git/src/terminal.ts index 0990e5c909e..867fddced84 100644 --- a/extensions/git/src/terminal.ts +++ b/extensions/git/src/terminal.ts @@ -69,16 +69,17 @@ export class TerminalShellExecutionManager { private onDidEndTerminalShellExecution(e: TerminalShellExecutionEndEvent): void { const { execution, exitCode, shellIntegration } = e; const [executable, subcommand] = execution.commandLine.value.split(/\s+/); + const cwd = execution.cwd ?? shellIntegration.cwd; - if (executable.toLowerCase() !== 'git' || !this.subcommands.has(subcommand.toLowerCase()) || !shellIntegration.cwd || exitCode !== 0) { + if (executable.toLowerCase() !== 'git' || !this.subcommands.has(subcommand.toLowerCase()) || !cwd || exitCode !== 0) { return; } this.logger.trace(`[TerminalShellExecutionManager][onDidEndTerminalShellExecution] Matched git subcommand: ${subcommand}`); - const repository = this.model.getRepository(shellIntegration.cwd); + const repository = this.model.getRepository(cwd); if (!repository) { - this.logger.trace(`[TerminalShellExecutionManager][onDidEndTerminalShellExecution] Unable to find repository for current working directory: ${shellIntegration.cwd}`); + this.logger.trace(`[TerminalShellExecutionManager][onDidEndTerminalShellExecution] Unable to find repository for current working directory: ${cwd.toString()}`); return; }