Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): run Git for Windows' real git.exe, not its launcher #17707

MergedSunkenInTime(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/17707/headmerged by juliusmarminge View on GitHub

Showing 3 changed files with 144 additions and 3 deletions.

x
0 of 3 viewed, 3 left
8 additions and 2 deletionsapps/server/src/vcs/GitVcsDriverCore.tsModified
View file
@@ -32,6 +32,7 @@
import * as HostProcess from "@t3tools/shared/HostProcess";
import { compactTraceAttributes } from "@t3tools/shared/observability";
import { decodeJsonResult } from "@t3tools/shared/schemaJson";
+import { resolveSpawnCommand } from "@t3tools/shared/shell";
import { parseT3ProjectFile } from "@t3tools/shared/t3ProjectFile";
import { resolveProjectFileBackedSetting } from "@t3tools/shared/projectSettings";
import { gitCommandDuration, gitCommandsTotal, withMetrics } from "../observability/Metrics.ts";
@@ -977,11 +978,16 @@
...input.env,
...trace2Monitor.env,
+ const spawnEnv = { ...env, ...windowsLongPathConfigEnv(hostPlatform, env) };
+ const resolved = yield* resolveSpawnCommand("git", [], { env: spawnEnv });
+ // A git.cmd wrapper would need cmd.exe, which cuts multi-line commit
+ // messages at the first newline; leave that case to Node's lookup.
+ const executable = resolved.shell ? "git" : resolved.command;
const child = yield* commandSpawner
.spawn(
- ChildProcess.make("git", commandInput.args, {
+ ChildProcess.make(executable, commandInput.args, {
cwd: commandInput.cwd,
- env: { ...env, ...windowsLongPathConfigEnv(hostPlatform, env) },
+ env: spawnEnv,
}),
.pipe(