Improve output of switch-branch.ps1

This commit is contained in:
Markus Fleschutz 2021-04-22 09:47:48 +02:00
parent f37ada4a70
commit 1a2abfaf61

View File

@ -17,7 +17,7 @@ try {
$Result = (git status)
if ($lastExitCode -ne "0") { throw "'git status' failed in $RepoDir" }
if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Repository is NOT clean: $Result" }
if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Git repository is NOT clean: $Result" }
& "$PSScriptRoot/fetch-repo.ps1"
if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" }
@ -31,6 +31,7 @@ try {
& git pull --recurse-submodules
if ($lastExitCode -ne "0") { throw "'git pull' failed" }
"switched Git repository 📂$RepoDir to branch 🌵$BranchName"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"