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)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
"🢃 Pulling updates..."
$Result = (git pull --recurse-submodules --jobs=4)
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"
}
$Result = (git status)
if ("$Result" -match "HEAD detached at ") {
write-warning "Not on a branch, so nothing to pull (in detached head state)"
} else {
"🢃 Pulling updates..."
& git pull --recurse-submodules --jobs=4
if ($lastExitCode -ne "0") { throw "'git pull' failed" }
}
$RepoDirName = (get-item "$RepoDir").Name