Update list-tags.ps1

This commit is contained in:
Markus Fleschutz 2022-11-02 21:43:10 +01:00
parent d0fe73ce11
commit 52eb6034bc

View File

@ -2,9 +2,9 @@
.SYNOPSIS .SYNOPSIS
Lists all tags in a Git repository Lists all tags in a Git repository
.DESCRIPTION .DESCRIPTION
This PowerShell script lists all tags in the given Git repository. This PowerShell script lists all tags in a Git repository.
.PARAMETER RepoDir .PARAMETER RepoDir
Specifies the path to the Git repository Specifies the path to the Git repository (current working directory by default)
.PARAMETER SearchPattern .PARAMETER SearchPattern
Specifies the search pattern (anything by default) Specifies the search pattern (anything by default)
.EXAMPLE .EXAMPLE
@ -23,16 +23,18 @@
param([string]$RepoDir = "$PWD", [string]$SearchPattern="*") param([string]$RepoDir = "$PWD", [string]$SearchPattern="*")
try { try {
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } Write-Progress "⏳ (1/3) Searching for Git executable... "
$Null = (git --version) $Null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
write-progress "🢃 Fetching latest tags..." Write-Progress "⏳ (2/3) Checking folder... "
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
Write-Progress "⏳ (3/3) Fetching latest tags..."
& git -C "$RepoDir" fetch --all --tags --quiet & git -C "$RepoDir" fetch --all --tags --quiet
if ($lastExitCode -ne "0") { throw "'git fetch --all --tags' failed" } if ($lastExitCode -ne "0") { throw "'git fetch --all --tags' failed" }
write-progress -completed "Fetched" Write-Progress -completed "Fetched"
"" ""
"Tag Description" "Tag Description"
"--- -----------" "--- -----------"