Don't take assumptions about the install location of git

This commit is contained in:
Matthias 2024-06-01 20:17:55 +02:00
parent a306f5a245
commit 86e50b1764

View File

@ -203,13 +203,13 @@ function Main {
# Pull latest updates only if the repository state is not dirty # Pull latest updates only if the repository state is not dirty
Write-Log "Checking if the repository is clean..." Write-Log "Checking if the repository is clean..."
$Status = & "C:\Program Files\Git\cmd\git.exe" status --porcelain $Status = & "git" status --porcelain
if ($Status) { if ($Status) {
Write-Log "Changes in local git repository. Skipping git pull." Write-Log "Changes in local git repository. Skipping git pull."
} }
else { else {
Write-Log "Pulling latest updates..." Write-Log "Pulling latest updates..."
& "C:\Program Files\Git\cmd\git.exe" pull 2>&1 | Out-File $LogFilePath -Append & "git" pull 2>&1 | Out-File $LogFilePath -Append
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
Write-Log "Failed to pull updates from Git." -Level 'ERROR' Write-Log "Failed to pull updates from Git." -Level 'ERROR'
Exit-Script -exitCode 1 Exit-Script -exitCode 1