Skip to content

feat: support regex tag exclusions - #5147

Merged
arturcic merged 3 commits into
mainfrom
feature/5130-ignore-tags
Aug 19, 2026
Merged

feat: support regex tag exclusions#5147
arturcic merged 3 commits into
mainfrom
feature/5130-ignore-tags

Conversation

@arturcic

@arturcic arturcic commented Aug 17, 2026

Copy link
Copy Markdown
Member

Description

Adds ignore.tags, a sequence of regular expressions for excluding tags from version-source discovery.

  • Matches case-insensitively against the friendly tag name without refs/tags/.
  • Uses OR semantics when multiple expressions are configured.
  • Rejects invalid expressions during configuration validation.
  • Keeps the tagged commit itself eligible for version calculation.
  • Includes configuration parsing, builder, cache isolation, public API, schema, workflow snapshot, documentation, and integration coverage.

Related issue

Part of #5130.

Stack

  1. #5151 - order configuration properties alphabetically
  2. This PR - ignore tags
  3. #5148 - ignore branches

Depends-On: #5151

Validation

  • GitVersion.Configuration.Tests: 107 passed.
  • Focused GitVersion.Core.Tests with LibGit2Sharp: 7 passed.
  • Focused GitVersion.Core.Tests with managed Git: 7 passed.
  • BuildPrepare completed successfully with zero warnings and errors.
  • dotnet format src/GitVersion.slnx --no-restore completed successfully.
  • Regenerated only schemas/7.0/GitVersion.configuration.json.

Checklist

  • Code follows the project style.
  • Documentation is updated.
  • Tests cover the change.
  • New and existing affected tests pass.

@arturcic
arturcic force-pushed the feature/5130-ignore-tags branch from a69984b to e0c2108 Compare August 17, 2026 20:45
@arturcic
arturcic marked this pull request as ready for review August 17, 2026 21:35
Copilot AI lite review requested due to automatic review settings August 17, 2026 21:35

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.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated no new comments.

@arturcic

Copy link
Copy Markdown
Member Author

Hi @HHobeck, could you please take a look at this PR when you have a chance? Thank you!

@arturcic
arturcic requested a review from HHobeck August 17, 2026 21:57
@arturcic
arturcic force-pushed the feature/5130-ignore-tags branch from e0c2108 to 5b7f820 Compare August 18, 2026 10:21
Copilot AI review requested due to automatic review settings August 18, 2026 11:03
@arturcic
arturcic force-pushed the feature/5130-ignore-tags branch from 5b7f820 to 854943a Compare August 18, 2026 11:03

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 changed the base branch from main to refactor/order-configuration-properties August 18, 2026 11:09
@mergify

mergify Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 ⛓️ Depends-On Requirements

Requirement based on the presence of Depends-On in the body of the pull request

Base automatically changed from refactor/order-configuration-properties to main August 18, 2026 11:46
@arturcic
arturcic force-pushed the feature/5130-ignore-tags branch from 854943a to 192ef29 Compare August 18, 2026 11:46
@arturcic
arturcic requested a review from asbjornu August 18, 2026 13:29
@arturcic
arturcic force-pushed the feature/5130-ignore-tags branch from 192ef29 to f71b9ec Compare August 18, 2026 17:22
@arturcic
arturcic force-pushed the feature/5130-ignore-tags branch from f71b9ec to 73bae1b Compare August 18, 2026 17:27
@mergify

mergify Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@gittools-bot
gittools-bot marked this pull request as draft August 18, 2026 18:07
@HHobeck

HHobeck commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

I need some time for the review. Anyway, what I was thinking about: Could we make case-insensitivity optional? Users who need it can easily add the modifier inline themselves, for example: (?i)^experimental-

Comment thread src/GitVersion.Core/Core/TaggedSemanticVersionRepository.cs Outdated
Comment thread src/GitVersion.Core/Core/TaggedSemanticVersionRepository.cs Outdated
@arturcic

Copy link
Copy Markdown
Member Author

Thanks for raising this. GitVersion currently compiles configuration-supplied regexes through the shared RegexPatterns.Cache, which applies RegexOptions.IgnoreCase. This includes branch regexes, tag-prefix, version-in-branch patterns, bump-message patterns, custom merge-message formats, and ignore.paths.

I’d therefore prefer to keep ignore.branches and ignore.tags case-insensitive by default for consistency with the existing configuration behavior.

Users who need case-sensitive matching can disable case-insensitive matching inline with (?-i), for example:

ignore:
  tags:
    - '(?-i)^experimental-'\n```\n\nThis matches `experimental-...` but not `Experimental-...`.

@HHobeck

HHobeck commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Thanks for raising this. GitVersion currently compiles configuration-supplied regexes through the shared RegexPatterns.Cache, which applies RegexOptions.IgnoreCase. This includes branch regexes, tag-prefix, version-in-branch patterns, bump-message patterns, custom merge-message formats, and ignore.paths.

I’d therefore prefer to keep ignore.branches and ignore.tags case-insensitive by default for consistency with the existing configuration behavior.

Users who need case-sensitive matching can disable case-insensitive matching inline with (?-i), for example:

ignore:
  tags:
    - '(?-i)^experimental-'\n```\n\nThis matches `experimental-...` but not `Experimental-...`.

Hmm okay. Can you document it? Fair enough if we want to have the behavior to be case insensitive. But why we have for example this in our configuration?

tag-prefix: "[vV]?"
version-in-branch-pattern: "(?<version>[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"

@arturcic
arturcic force-pushed the feature/5130-ignore-tags branch from 588e9ed to a1c81bc Compare August 19, 2026 10:32
@sonarqubecloud

Copy link
Copy Markdown

@arturcic

Copy link
Copy Markdown
Member Author

Hmm okay. Can you document it?

@HHobeck Documented in a1c81bc: the reference now explains the case-insensitive default and (?-i) opt-out, and every regex-specific schema description includes the same guidance. The [vV] defaults are redundant under the current behavior, so I left them unchanged as unrelated cleanup.

@arturcic

Copy link
Copy Markdown
Member Author

Hi @HHobeck, when you have a chance, could you please take another look at the updated PR? Your review feedback has been addressed. Thank you!

@arturcic
arturcic marked this pull request as ready for review August 19, 2026 10:45
Copilot AI review requested due to automatic review settings August 19, 2026 10:45

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 merged commit 04869cd into main Aug 19, 2026
67 checks passed
@arturcic
arturcic deleted the feature/5130-ignore-tags branch August 19, 2026 11:08
@mergify

mergify Bot commented Aug 19, 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.

4 participants