Skip to content

Commit 15b21af

Browse files
committed
fix: do not install git if already installed
1 parent 873a0ce commit 15b21af

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

dist/legacy/setup-cpp.js

Lines 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

Lines 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

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/modern/setup-cpp.mjs.map

Lines 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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { existsSync } from "fs"
2-
import { warning } from "ci-log"
2+
import { info, warning } from "ci-log"
33
import { addPath } from "envosman"
44
import { installAptPack } from "setup-apt"
55
import { installBrewPack } from "setup-brew"
6+
import which from "which"
67
import { rcOptions } from "../cli-options.js"
78
import { hasDnf } from "../utils/env/hasDnf.js"
89
import { isArch } from "../utils/env/isArch.js"
@@ -13,6 +14,12 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
1314

1415
// eslint-disable-next-line @typescript-eslint/no-unused-vars
1516
export async function setupGit(version: string, _setupDir: string, _arch: string) {
17+
const git = await which("git", { nothrow: true })
18+
if (git !== null) {
19+
info(`Git already installed at ${git}`)
20+
return
21+
}
22+
1623
switch (process.platform) {
1724
case "win32": {
1825
const result = await setupChocoPack("git", version)

0 commit comments

Comments
 (0)