From 5665692aac0ef428fdb6bac4915d9230b68f9a1c Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Thu, 27 May 2021 07:36:24 +0200 Subject: [PATCH] Improve list-tags.ps1 --- Scripts/list-tags.ps1 | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Scripts/list-tags.ps1 b/Scripts/list-tags.ps1 index b63babd2..600d805b 100755 --- a/Scripts/list-tags.ps1 +++ b/Scripts/list-tags.ps1 @@ -9,22 +9,23 @@ param($RepoDir = "$PWD", $Pattern="*") try { if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } - set-location "$RepoDir" $Null = (git --version) if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } - & "$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 -C "$RepoDir" fetch --all + if ($lastExitCode -ne "0") { throw "'git fetch --all' failed" } write-output "" - write-output "List of Git Tags" - write-output "----------------" + write-output "Git Tags" + write-output "--------" - & git tag --list "$Pattern" + & git -C "$RepoDir" tag --list "$Pattern" --column if ($lastExitCode -ne "0") { throw "'git tag --list' failed" } - write-output "" exit 0 } catch { write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"