From ca2da4426615ea80d8736b6b7e35b9adb712e396 Mon Sep 17 00:00:00 2001 From: Steve Streeting Date: Fri, 29 May 2020 12:19:22 +0100 Subject: [PATCH] Detect if using Git or not --- ue4-cleanup.ps1 | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ue4-cleanup.ps1 b/ue4-cleanup.ps1 index fb525de..e0b0ce1 100644 --- a/ue4-cleanup.ps1 +++ b/ue4-cleanup.ps1 @@ -110,13 +110,17 @@ try { } - if (-not $nolfsprune) { - if ($dryrun) { - Write-Output "Would have pruned LFS files" - git lfs prune --dry-run - } else { - Write-Output "Pruning Git LFS files" - git lfs prune + + $isGit = Test-Path .git + if ($isGit) { + if (-not $nolfsprune) { + if ($dryrun) { + Write-Output "Would have pruned LFS files" + git lfs prune --dry-run + } else { + Write-Output "Pruning Git LFS files" + git lfs prune + } } } Write-Output "-- Cleanup finished OK --"