Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 873a0ce

Browse filesBrowse files
committed
fix: add script to find the git binaries on Windows
1 parent ae8148b commit 873a0ce
Copy full SHA for 873a0ce

File tree

Expand file treeCollapse file tree

5 files changed

+25
-6
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+25
-6
lines changed

‎dist/legacy/setup-cpp.js

Copy file name to clipboardExpand all lines: dist/legacy/setup-cpp.js
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/legacy/setup-cpp.js.map

Copy file name to clipboardExpand all lines: dist/legacy/setup-cpp.js.map
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/modern/setup-cpp.mjs

Copy file name to clipboardExpand all lines: dist/modern/setup-cpp.mjs
+1-1Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎dist/modern/setup-cpp.mjs.map

Copy file name to clipboardExpand all lines: dist/modern/setup-cpp.mjs.map
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/git/git.ts

Copy file name to clipboardExpand all lines: src/git/git.ts
+21-2Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { existsSync } from "fs"
2+
import { warning } from "ci-log"
13
import { addPath } from "envosman"
24
import { installAptPack } from "setup-apt"
35
import { installBrewPack } from "setup-brew"
@@ -14,8 +16,10 @@ export async function setupGit(version: string, _setupDir: string, _arch: string
1416
switch (process.platform) {
1517
case "win32": {
1618
const result = await setupChocoPack("git", version)
17-
result.binDir = "C:/Program Files (x86)/Git/bin"
18-
await addPath(result.binDir, rcOptions)
19+
const gitDir = findWindowsGit()
20+
if (gitDir !== null) {
21+
await addPath(gitDir, rcOptions)
22+
}
1923
return result
2024
}
2125
case "darwin": {
@@ -36,3 +40,18 @@ export async function setupGit(version: string, _setupDir: string, _arch: string
3640
}
3741
}
3842
}
43+
44+
function findWindowsGit() {
45+
const candidates = [
46+
"C:/Program Files/Git/bin/git.exe",
47+
"C:/Program Files (x86)/Git/bin/git.exe",
48+
]
49+
for (const candidate of candidates) {
50+
if (existsSync(candidate)) {
51+
return candidate
52+
}
53+
}
54+
55+
warning("Git not found in the default locations. Add git to PATH manually.")
56+
return null
57+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.