Improve pull-repo.ps1

This commit is contained in:
Markus Fleschutz 2021-06-08 13:49:01 +02:00
parent d112db2e7b
commit b9778d28fe

View File

@ -16,14 +16,13 @@ try {
$Null = (git --version) $Null = (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" }
"🢃 Pulling updates..." $Result = (git status)
$Result = (git pull --recurse-submodules --jobs=4) if ("$Result" -match "HEAD detached at ") {
if ($lastExitCode -ne "0") { write-warning "Not on a branch, so nothing to pull (in detached head state)"
if ("$Result" -match "You are not currently on a branch.") {
"NOTE: not on a branch, nothing to pull"
} else { } else {
throw "'git pull' failed" "🢃 Pulling updates..."
} & git pull --recurse-submodules --jobs=4
if ($lastExitCode -ne "0") { throw "'git pull' failed" }
} }
$RepoDirName = (get-item "$RepoDir").Name $RepoDirName = (get-item "$RepoDir").Name