From 61e75293d7a74605f2f48310d8406825673d7c8f Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Tue, 18 Apr 2023 14:26:07 +0200 Subject: [PATCH] Update new-branch.ps1 --- Scripts/new-branch.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Scripts/new-branch.ps1 b/Scripts/new-branch.ps1 index aefbd912..b35e96c2 100755 --- a/Scripts/new-branch.ps1 +++ b/Scripts/new-branch.ps1 @@ -26,9 +26,9 @@ try { & git --version if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } - $RepoDirName = (Get-Item "$RepoDir").Name - Write-Host "⏳ (2/6) Checking Git repository... 📂$RepoDirName" + Write-Host "⏳ (2/6) Checking repository... 📂$RepoDir" if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } + $RepoDirName = (Get-Item "$RepoDir").Name "⏳ (3/6) Fetching latest updates..." & git -C "$RepoDir" fetch --all --recurse-submodules --prune --prune-tags --force @@ -37,7 +37,7 @@ try { $CurrentBranchName = (git -C "$RepoDir" rev-parse --abbrev-ref HEAD) if ($lastExitCode -ne "0") { throw "'git rev-parse' failed with exit code $lastExitCode" } - "⏳ (4/6) Creating new branch..." + "⏳ (4/6) Creating branch..." & git -C "$RepoDir" checkout -b "$NewBranchName" if ($lastExitCode -ne "0") { throw "'git checkout -b $NewBranchName' failed with exit code $lastExitCode" } @@ -50,7 +50,7 @@ try { if ($lastExitCode -ne "0") { throw "'git submodule update' failed with exit code $lastExitCode" } [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds - "✔️ created new branch '$NewBranchName' in 📂$RepoDirName repository (based on '$CurrentBranchName') in $Elapsed sec." + "✔️ created branch '$NewBranchName' in repo 📂$RepoDirName (based on '$CurrentBranchName') in $Elapsed sec" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"