fix: version match

This commit is contained in:
Bjarke Sporring
2026-01-14 17:40:57 +01:00
parent 2633ee2b71
commit cc2d43d14b

View File

@@ -131,7 +131,7 @@ function Install-Package {
if ($MinVersion -and $version) { if ($MinVersion -and $version) {
# Extract semantic version numbers only - stop before any non-digit/non-dot characters # Extract semantic version numbers only - stop before any non-digit/non-dot characters
# This extracts "2.52.0" from "2.52.0.windows.1" # This extracts "2.52.0" from "2.52.0.windows.1"
if ($version -match '^(\d+(?:\.\d+){1,2})') { if ($version -match '^\d+(?:\.\d+)*') {
$installedVersion = $matches[1] $installedVersion = $matches[1]
try { try {
if ([version]$installedVersion -lt [version]$MinVersion) { if ([version]$installedVersion -lt [version]$MinVersion) {
@@ -207,7 +207,7 @@ function Test-GitVersion {
# Parse Git version from various formats: # Parse Git version from various formats:
# "git version 2.52.0", "git version 2.52.0.windows.1", etc. # "git version 2.52.0", "git version 2.52.0.windows.1", etc.
if ($version -match 'git version (\d+)\.(\d+)') { if ($version -match 'git version ^\d+(?:\.\d+)*') {
$majorVersion = [int]$matches[1] $majorVersion = [int]$matches[1]
$minorVersion = [int]$matches[2] $minorVersion = [int]$matches[2]