Update fetch-repo.ps1

This commit is contained in:
Markus Fleschutz 2022-05-02 10:40:19 +02:00
parent 0951bbc4cb
commit 39d17bbf49

View File

@ -19,18 +19,18 @@ try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
"⏳ Step 1/2: Checking requirements... "
& git --version
$null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder: $RepoDir" }
"⏳ Step 2/2: Fetching updates (including submodules)... "
"⏳ Step 2/2: Fetching updates... "
& git -C "$RepoDir" fetch --all --recurse-submodules --prune --prune-tags --force
if ($lastExitCode -ne "0") { throw "'git fetch' failed with exit code $lastExitCode" }
$RepoDirName = (get-item "$RepoDir").Name
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ fetched updates for repo 📂$RepoDirName in $Elapsed sec"
"✔️ fetched updates for 📂$RepoDirName repo in $Elapsed sec"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"