Skip to content

Fix PSVersionTable tag GitCommitId test#27523

Open
KirtiRamchandani wants to merge 1 commit into
PowerShell:masterfrom
KirtiRamchandani:fix/psversiontable-tag-gitcommitid
Open

Fix PSVersionTable tag GitCommitId test#27523
KirtiRamchandani wants to merge 1 commit into
PowerShell:masterfrom
KirtiRamchandani:fix/psversiontable-tag-gitcommitid

Conversation

@KirtiRamchandani
Copy link
Copy Markdown

PR Summary

Update PSVersionTable.Tests.ps1 so tag builds accept both valid GitCommitId forms:

  • release tag builds that report only the semantic version, such as 7.6.2
  • clean tag builds that report the git describe --long form, such as 7.6.2-0-g<sha>

PR Context

ProductVersion for a tag build can include SHA: <sha> even when the built GitCommitId is 7.6.2-0-g<sha>. The previous test treated the -0-g<sha> form as unexpected whenever ProductVersion did not include Commits:, which makes the test fail for clean builds from a release tag.

This keeps the exact check for normal commit builds, strips any +<source revision> suffix from the product-version SHA before comparing, and adds regression coverage for the zero-commit tag case.

Fixes #27503

PR Checklist

Tests

  • Start-PSBootstrap -Scenario Dotnet
  • Start-PSBuild -UseNuGetOrg -SkipExperimentalFeatureGeneration
  • Start-PSPester -Path ./test/powershell/Host/PSVersionTable.Tests.ps1 -UseNuGetOrg -SkipTestToolBuild -ThrowOnFailure (16 passed)
  • git diff --check

Copilot AI review requested due to automatic review settings May 25, 2026 01:11
@KirtiRamchandani KirtiRamchandani requested a review from a team as a code owner May 25, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PSVersionTable.Tests.ps1 handles certain builds incorrectly.

1 participant