From 37b85938a46b4219c66d614a435e9873fd6843c5 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Wed, 27 Apr 2022 11:11:20 +0200 Subject: [PATCH] Add one retry to clean-repo.ps1 --- Scripts/clean-repo.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Scripts/clean-repo.ps1 b/Scripts/clean-repo.ps1 index 8d4417c2..7ee8c144 100755 --- a/Scripts/clean-repo.ps1 +++ b/Scripts/clean-repo.ps1 @@ -20,14 +20,18 @@ try { $StopWatch = [system.diagnostics.stopwatch]::startNew() "⏳ Step 1/3: Checking requirements..." - if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access repository folder at: $RepoDir - maybe a typo or missing folder permissions?" } + if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access folder '$RepoDir' - maybe a typo or missing folder permissions?" } $null = (git --version) if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } "⏳ Step 2/3: Cleaning repository..." & git -C "$RepoDir" clean -xfd -f # to delete all untracked files in the main repo - if ($lastExitCode -ne "0") { throw "'git clean' failed with exit code $lastExitCode" } + if ($lastExitCode -ne "0") { + "'git clean' failed with exit code $lastExitCode, retrying once..." + & git -C "$RepoDir" clean -xfd -f + if ($lastExitCode -ne "0") { throw "'git clean' failed with exit code $lastExitCode" } + } "⏳ Step 3/3: Cleaning submodules..." & git -C "$RepoDir" submodule foreach --recursive git clean -xfd -f # to delete all untracked files in the submodules