Updated fetch-repos.ps1

This commit is contained in:
Markus Fleschutz 2024-09-12 07:21:20 +02:00
parent b8d9a4dc19
commit f802f9ed9b

View File

@ -7,9 +7,9 @@
Specifies the path to the parent folder Specifies the path to the parent folder
.EXAMPLE .EXAMPLE
PS> ./fetch-repos.ps1 C:\MyRepos PS> ./fetch-repos.ps1 C:\MyRepos
(1) Searching for Git executable... git version 2.42.0 (1) Searching for Git executable... git version 2.46.0.windows.1
(2) Checking parent folder... 33 subfolders (2) Checking parent folder... 33 subfolders
(3/35) Fetching into 📂base256unicode... (3/35) Fetching into 📂curl...
... ...
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
@ -39,12 +39,12 @@ try {
Write-Host "⏳ ($step/$($numFolders + 2)) Fetching into 📂$folderName...`t`t" Write-Host "⏳ ($step/$($numFolders + 2)) Fetching into 📂$folderName...`t`t"
& git -C "$folder" fetch --all --recurse-submodules --prune --prune-tags --force & git -C "$folder" fetch --all --recurse-submodules --prune --prune-tags --force
if ($lastExitCode -ne "0") { throw "'git fetch --all' in $folder failed with exit code $lastExitCode" } if ($lastExitCode -ne "0") { throw "'git fetch --all' in 📂$folder failed with exit code $lastExitCode" }
$step++ $step++
} }
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds [int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✔️ Fetched updates into $numFolders repos under 📂$parentDirPathName in $elapsed sec" "✔️ Fetched into $numFolders repos under 📂$parentDirPathName in $($elapsed)s."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"