@@ -693,8 +693,8 @@ export const resolveCommandPath = Effect.fn("shell.resolveCommandPath")(function
693693 } ) ;
694694} ) ;
695695
696- // Newest layout first: Git for Windows 2.56 moved x64 builds from mingw64 to
697- // ucrt64, and an upgraded install can keep the old folder .
696+ // Git for Windows 2.56 moved x64 builds from mingw64 to ucrt64; ARM64 builds
697+ // live in clangarm64 and 32-bit ones in mingw32 .
698698const GIT_FOR_WINDOWS_BUILDS = [ "ucrt64" , "clangarm64" , "mingw64" , "mingw32" ] as const ;
699699
700700function isFileSync ( filePath : string ) : boolean {
@@ -706,13 +706,14 @@ function isFileSync(filePath: string): boolean {
706706}
707707
708708/**
709- * Swaps Git for Windows' launcher (`<Git>\cmd\git.exe` or `<Git>\bin\git.exe`,
710- * the only git the installer puts on PATH by default) for the git.exe it
711- * starts. The launcher costs a second process on every git command, and each
712- * launch leaks a kernel token reference that slows process creation
713- * machine-wide until reboot. The real binary sets MSYSTEM, HOME and its own
714- * PATH entries for hooks, ssh and credential helpers, but only when MSYSTEM is
715- * unset, so the launcher stays when it is set. Anything else is returned as is.
709+ * Swaps Git for Windows' launcher (`<Git>\cmd\git.exe`, the only git its
710+ * installer puts on PATH, or the portable build's `<Git>\bin\git.exe`) for the
711+ * git.exe it starts. The launcher costs a second process on every git command,
712+ * and each launch leaks a kernel token reference that slows process creation
713+ * machine-wide until reboot. The real binary sets HOME itself, but adds its own
714+ * folders to PATH for hooks, ssh and credential helpers only when MSYSTEM is
715+ * unset, so the launcher stays when MSYSTEM is set. Anything else is returned
716+ * as is.
716717 */
717718export function preferGitForWindowsBinary (
718719 executable : string ,
@@ -764,7 +765,6 @@ export const resolveSpawnCommand = Effect.fnUntraced(function* (
764765 platform ,
765766 resolvePathEnvironmentVariable ( env ) ,
766767 resolveWindowsPathExtensions ( env ) . join ( ";" ) ,
767- env . MSYSTEM ? "msystem" : "" ,
768768 command ,
769769 ] . join ( COMMAND_RESOLUTION_CACHE_KEY_SEPARATOR ) ;
770770 const nowNanos = yield * Clock . currentTimeNanos ;
@@ -773,13 +773,14 @@ export const resolveSpawnCommand = Effect.fnUntraced(function* (
773773 if ( cached !== undefined && cached . expiresAtNanos > nowNanos ) {
774774 resolvedExecutable = cached . resolvedPath ;
775775 } else {
776- const found = resolveExecutable ( command , platform , env ) ;
777- resolvedExecutable = found === undefined ? null : preferGitForWindowsBinary ( found , env ) ;
776+ resolvedExecutable = resolveExecutable ( command , platform , env ) ?? null ;
778777 if ( ! explicitPath && resolvedExecutable !== null ) {
779778 cacheCommandResolution ( cache , cacheKey , resolvedExecutable , nowNanos ) ;
780779 }
781780 }
782- const resolvedCommand = resolvedExecutable ?? command ;
781+ // Outside the cache: a Git upgrade moves the real binary, never the launcher.
782+ const resolvedCommand =
783+ resolvedExecutable === null ? command : preferGitForWindowsBinary ( resolvedExecutable , env ) ;
783784 const extension = NodePath . win32 . extname ( resolvedCommand ) . toLowerCase ( ) ;
784785 if ( extension !== ".cmd" && extension !== ".bat" ) {
785786 return { command : resolvedCommand , args : [ ...args ] , shell : false } ;
0 commit comments