Update fetch-repo.ps1

This commit is contained in:
Markus Fleschutz 2022-12-04 11:44:20 +01:00
parent 4ef2f3e384
commit 2c026ee81e

View File

@ -10,7 +10,7 @@
(1/3) Searching for Git executable... git version 2.38.1.windows.1
(2/3) Checking Git repository 📂PowerShell...
(3/3) Fetching updates (including submodules)...
fetched updates for Git repository 📂PowerShell in 2 sec.
fetched updates for 📂PowerShell repository in 2 sec.
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -27,15 +27,15 @@ try {
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
$RepoDirName = (Get-Item "$RepoDir").Name
"⏳ (2/3) Checking Git repository 📂$RepoDirName... "
Write-Host "⏳ (2/3) Checking Git repository... 📂$RepoDirName"
if (!(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder: $RepoDir" }
"⏳ (3/3) Fetching updates (including submodules)... "
Write-Host "⏳ (3/3) 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" }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ fetched updates for Git repository 📂$RepoDirName in $Elapsed sec."
"✔️ fetched updates for 📂$RepoDirName repository in $Elapsed sec."
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"