fix: do not install git if already installed

This commit is contained in:
Amin Yahyaabadi 2025-03-08 23:30:52 -08:00
parent 873a0ce059
commit 15b21af353
5 changed files with 12 additions and 5 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,9 @@
import { existsSync } from "fs"
import { warning } from "ci-log"
import { info, warning } from "ci-log"
import { addPath } from "envosman"
import { installAptPack } from "setup-apt"
import { installBrewPack } from "setup-brew"
import which from "which"
import { rcOptions } from "../cli-options.js"
import { hasDnf } from "../utils/env/hasDnf.js"
import { isArch } from "../utils/env/isArch.js"
@ -13,6 +14,12 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupGit(version: string, _setupDir: string, _arch: string) {
const git = await which("git", { nothrow: true })
if (git !== null) {
info(`Git already installed at ${git}`)
return
}
switch (process.platform) {
case "win32": {
const result = await setupChocoPack("git", version)