From a5a73c929b8b85b25e0ce39564a67494dbecedd1 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Wed, 5 May 2021 16:46:03 +0200 Subject: [PATCH] Improve output of switch-branch.ps1 --- Scripts/switch-branch.ps1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Scripts/switch-branch.ps1 b/Scripts/switch-branch.ps1 index 0b022963..e4c0c8d2 100755 --- a/Scripts/switch-branch.ps1 +++ b/Scripts/switch-branch.ps1 @@ -20,8 +20,11 @@ try { if ($lastExitCode -ne "0") { throw "'git status' failed in $RepoDir" } 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" } + $RepoDirName = (get-item "$RepoDir").Name + "🢃 Fetching updates for Git repository 📂$RepoDirName ..." + + & git fetch --all --recurse-submodules --jobs=4 + if ($lastExitCode -ne "0") { throw "'git fetch -all --recurse-submodules' failed" } & git switch "$BranchName" if ($lastExitCode -ne "0") { throw "'git switch $BranchName' failed" } @@ -32,7 +35,7 @@ try { & git submodule update --init --recursive if ($lastExitCode -ne "0") { throw "'git submodule update' failed" } - "✔️ switched Git repository 📂$RepoDir to branch 🌵$BranchName" + "✔️ switched to branch '$BranchName'" exit 0 } catch { write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"