Skip to content

Commit 681293c

Browse files
committed
🐛 Fix where empty TagPrefix would be a component
1 parent fd12e67 commit 681293c

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

PSGitChangeLog/Public/Get-GitTagList.Tools.ps1

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Function Get-GitTagList {
1+
Function Get-GitTagList {
22
<#
33
.SYNOPSIS
44
Gets a normalized list of Git Tags of the current Git Repo
@@ -9,15 +9,18 @@ Function Get-GitTagList {
99
Get-GitTagList
1010
#>
1111
Param (
12+
[string]
1213
$TagPrefix
1314
,
14-
[switch] $Latest
15+
[switch]
16+
$Latest
1517
,
16-
[switch] $GitVersionContiniousDeploymentMode
18+
[switch]
19+
$GitVersionContiniousDeploymentMode
1720
)
1821

1922
$gittagdata = git for-each-ref --sort=taggerdate --format='%(if)%(*objectname)%(then)%(*objectname)%(else)%(objectname)%(end)##%(refname)##%(taggerdate:iso)' refs/tags
20-
If ($TagPrefix) {
23+
If ($TagPrefix -notin $null,'') {
2124
$gittagdata = $gittagdata | Where-Object { $_ -match "refs/tags/$TagPrefix-" }
2225
}
2326
$taglist = @()
@@ -30,7 +33,7 @@ Function Get-GitTagList {
3033

3134
$tagParts = $tagvalue -Split '-'
3235
ForEach ($tagPart in $tagParts) {
33-
If ($TagPrefix -and $tagPart -eq $TagPrefix) { continue }
36+
If ($TagPrefix -notin $null,'' -and $tagPart -eq $TagPrefix) { continue }
3437
$tagPart = $tagPart.Replace('v', '')
3538
Try {
3639
# Tags needs to be a valid SemVerId

0 commit comments

Comments
 (0)