Improve the output

This commit is contained in:
Markus Fleschutz
2021-04-27 11:12:51 +02:00
parent e2188fa160
commit 0f9dcffc68
4 changed files with 14 additions and 16 deletions

View File

@ -8,24 +8,21 @@
param($RepoDir = "$PWD")
try {
$RepoDir = resolve-path "$RepoDir"
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
set-location "$RepoDir"
"⏳ Fetching updates for Git repository 📂$RepoDir ..."
$RepoDirName = (get-item "$RepoDir").Name
"⏳ Fetching updates for Git repository 📂$RepoDirName ..."
$Null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
& git fetch --all --recurse-submodules --jobs=4
if ($lastExitCode -ne "0") {
write-warning "Retrying once ..."
start-sleep -milliseconds 1000
& git fetch --all --recurse-submodules --jobs=1
if ($lastExitCode -ne "0") { throw "'git fetch' failed (twice)" }
}
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
"✔️ fetched Git repository 📂$RepoDirName"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}