Skip to content

Commit ec2b8a7

Browse files
committed
Avoid picking up a git.exe from the current directory
When running Git's test suite, there is a `git.exe` in the current directory, and trying to use it fails because it won't look in the correct place for `git-remote-https.exe`. This is the symptom: ⏷ Cloning git-sdk-64 Notice: Cloning https://github.com/git-for-windows/git-sdk-64 to .tmp git: 'remote-https' is not a git command. See 'git --help'. Let's fix this bug by always specifying the full path to the Git executable we intend to be used. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 2ad870f commit ec2b8a7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/git.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {Octokit} from '@octokit/rest'
44
import {delimiter} from 'path'
55

66
const gitForWindowsUsrBinPath = 'C:/Program Files/Git/usr/bin'
7+
const gitExePath = 'C:/Program Files/Git/cmd/git.exe'
78

89
/*
910
* It looks a bit ridiculous to use 56 workers on a build agent that has only
@@ -24,7 +25,7 @@ async function clone(
2425
): Promise<void> {
2526
if (verbose) core.notice(`Cloning ${url} to ${destination}`)
2627
const child = spawn(
27-
'git.exe',
28+
gitExePath,
2829
[
2930
'clone',
3031
'--depth=1',
@@ -109,7 +110,7 @@ export async function getViaGit(
109110
if (flavor === 'full') {
110111
core.startGroup(`Checking out ${repo}`)
111112
child = spawn(
112-
'git.exe',
113+
gitExePath,
113114
[`--git-dir=.tmp`, 'worktree', 'add', outputDirectory, head_sha],
114115
{
115116
env: {

0 commit comments

Comments
 (0)