Skip to content

feat: support commit SHA placeholders in branch labels - #5191

Merged
arturcic merged 1 commit into
GitTools:mainfrom
arturcic:codex/3035-sha-labels
Sep 9, 2026
Merged

feat: support commit SHA placeholders in branch labels#5191
arturcic merged 1 commit into
GitTools:mainfrom
arturcic:codex/3035-sha-labels

Conversation

@arturcic

@arturcic arturcic commented Sep 8, 2026

Copy link
Copy Markdown
Member

Description

Branch labels such as label: 'ci.{ShortSha}' currently fail with an unknown-placeholder error. Add {Sha} and {ShortSha} using the commit being versioned, so these templates participate in version calculation under calculation.branches.<branch>.label.

Pass the calculation commit through version-search strategies and recursive mainline traversal. Reuse the existing seven-character short-SHA operation. Named regex captures retain precedence, including empty captures, and existing formatting, fallbacks, sanitization, and missing-placeholder errors remain unchanged.

Update the configuration reference and generated v7 schema. The same templates work through explicit v6 compatibility mode and configuration migration.

Related Issue

Resolves #3035

Motivation and Context

Allow commit hashes in calculated prerelease labels while preserving existing regex-based configurations. The new built-ins are limited to Sha and ShortSha; prerelease numbering continues to follow the selected deployment mode.

How Has This Been Tested?

Local validation on macOS with .NET 10:

  • Full core suite: 36,269 passed.
  • Full configuration suite: 198 passed.
  • CLI configuration integration suite: 25 passed.
  • History regressions cover both managed and LibGit2Sharp backends, successive commits, explicit historical commits, nested merges, and tagged-current behavior.
  • Temporarily removing the SHA inputs caused six new placeholder cases to fail; restoring them returned the configuration suite to green.
  • Full solution build: zero warnings/errors. Formatting and diff checks passed.
  • Repeated schema/reference generation produced identical files.

Checklist

  • Code follows the project style.
  • Documentation and generated schema updated.
  • Regression tests added.
  • Relevant test suites passed.

@arturcic
arturcic marked this pull request as ready for review September 9, 2026 06:14
Copilot AI lite review requested due to automatic review settings September 9, 2026 06:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@arturcic
arturcic requested a lite review from Copilot September 9, 2026 06:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This comment was marked as resolved.

Copilot AI review requested due to automatic review settings September 9, 2026 07:10
@arturcic
arturcic force-pushed the codex/3035-sha-labels branch from 6d73607 to cdd5e93 Compare September 9, 2026 07:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It changes core version calculation pathways (including mainline traversal) by threading commit context broadly, so a final human review should validate the behavioral impact despite strong test coverage.

Review details
  • Files reviewed: 30/30 changed files
  • Comments generated: 1
  • Review effort level: Lite

@arturcic
arturcic force-pushed the codex/3035-sha-labels branch from cdd5e93 to 71ab5a9 Compare September 9, 2026 07:17
Copilot AI review requested due to automatic review settings September 9, 2026 07:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@arturcic
arturcic requested a review from asbjornu September 9, 2026 07:29
Copilot AI review requested due to automatic review settings September 9, 2026 08:18
@arturcic
arturcic force-pushed the codex/3035-sha-labels branch from 71ab5a9 to 02a7efa Compare September 9, 2026 08:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@asbjornu asbjornu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just got a few questions and comments.

Comment thread schemas/7.0/GitVersion.configuration.json Outdated
Comment thread src/GitVersion.App.Tests/ConfigurationVersionIntegrationTests.cs Outdated
Comment thread src/GitVersion.Configuration/BranchConfiguration.cs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It makes broad, cross-cutting changes in core version-calculation paths (strategies + recursive mainline traversal), and should receive final human sign-off despite strong test coverage updates.

Review details
  • Files reviewed: 30/30 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@arturcic
arturcic force-pushed the codex/3035-sha-labels branch from 02a7efa to 0df22f8 Compare September 9, 2026 09:25
Copilot AI review requested due to automatic review settings September 9, 2026 09:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@arturcic

arturcic commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Thanks! Updated the wording and regenerated the schema. Both tests now deserialize into GitVersionConfiguration; the migration test retains explicit YAML structure checks.

@sonarqubecloud

sonarqubecloud Bot commented Sep 9, 2026

Copy link
Copy Markdown

@arturcic
arturcic enabled auto-merge September 9, 2026 09:52
@arturcic
arturcic requested a review from asbjornu September 9, 2026 10:11
@arturcic
arturcic merged commit 205c0ca into GitTools:main Sep 9, 2026
39 checks passed
@arturcic
arturcic deleted the codex/3035-sha-labels branch September 9, 2026 12:05
@mergify

mergify Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Thank you @arturcic for your contribution!

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.

Enable support for {Sha} and {ShortSha} variables inside tag property

3 participants