( deps: EnvironmentDeps, gitExe: string, )
| 153 | } |
| 154 | |
| 155 | async function readGitExecPath( |
| 156 | deps: EnvironmentDeps, |
| 157 | gitExe: string, |
| 158 | ): Promise<string | undefined> { |
| 159 | if (deps.platform === 'win32' && !isAbsoluteWindowsPath(gitExe)) return undefined; |
| 160 | |
| 161 | const stdout = await deps.execFileText(gitExe, ['--exec-path'], GIT_EXEC_PATH_TIMEOUT_MS); |
| 162 | if (stdout === undefined) return undefined; |
| 163 | |
| 164 | for (const line of stdout.split(/\r?\n/)) { |
| 165 | const execPath = line.trim(); |
| 166 | if (execPath.length > 0) { |
| 167 | return execPath; |
| 168 | } |
| 169 | } |
| 170 | return undefined; |
| 171 | } |
| 172 | |
| 173 | // Most Git for Windows installs put `git.exe` in `<root>\cmd\git.exe`, |
| 174 | // with bash at `<root>\bin\bash.exe`. Portable installs sometimes put |
no test coverage detected