Improve pull-repo.ps1

This commit is contained in:
Markus Fleschutz 2021-06-08 13:30:00 +02:00
parent 73c7d362da
commit cd2bd97708

View File

@ -17,8 +17,14 @@ try {
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" }
"🢃 Pulling updates..." "🢃 Pulling updates..."
& git pull --recurse-submodules --jobs=4 $Result = (git pull --recurse-submodules --jobs=4)
if ($lastExitCode -ne "0") { throw "'git pull' failed" } if ($lastExitCode -ne "0") {
if ("$Result" -match "You are not currently on a branch.") {
"NOTE: not on a branch, nothing to pull"
} else {
throw "'git pull' failed" }
}
}
$RepoDirName = (get-item "$RepoDir").Name $RepoDirName = (get-item "$RepoDir").Name
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds