mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-09 01:25:04 +01:00
Improve both scripts
This commit is contained in:
parent
df7cbfab55
commit
55f9c2e19f
@ -9,7 +9,7 @@
|
|||||||
param($RepoDir = "$PWD")
|
param($RepoDir = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
write-output "Fetching updates for Git repository $RepoDir ..."
|
"Fetching updates for Git repository $RepoDir ..."
|
||||||
|
|
||||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
set-location "$RepoDir"
|
set-location "$RepoDir"
|
||||||
@ -17,11 +17,12 @@ try {
|
|||||||
& git --version
|
& git --version
|
||||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
|
|
||||||
& git fetch --all --recurse-submodules
|
& git fetch --all --recurse-submodules --jobs=4
|
||||||
if ($lastExitCode -ne "0") { throw "'git fetch --all --recurse-submodules' failed" }
|
if ($lastExitCode -ne "0") { # retry once:
|
||||||
|
start-sleep -milliseconds 1000
|
||||||
& git status
|
& git fetch --all --recurse-submodules --jobs=1
|
||||||
if ($lastExitCode -ne "0") { throw "'git status' failed" }
|
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
|
||||||
|
}
|
||||||
|
|
||||||
write-host -foregroundColor green "OK - fetched updates for Git repository $RepoDir"
|
write-host -foregroundColor green "OK - fetched updates for Git repository $RepoDir"
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -20,13 +20,9 @@ try {
|
|||||||
|
|
||||||
[int]$Count = 0
|
[int]$Count = 0
|
||||||
get-childItem $ParentDir -attributes Directory | foreach-object {
|
get-childItem $ParentDir -attributes Directory | foreach-object {
|
||||||
"Fetching updates for $($_.FullName)..."
|
& "$PSScriptRoot/fetch-repo.ps1" "$($_.FullName)"
|
||||||
set-location $_.FullName
|
if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" }
|
||||||
|
|
||||||
& git fetch --all --recurse-submodules
|
|
||||||
if ($lastExitCode -ne "0") { throw "'git fetch --all --recurse-submodules' failed" }
|
|
||||||
|
|
||||||
set-location ..
|
|
||||||
$Count++
|
$Count++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user