Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 35 additions & 5 deletions docs/input/docs/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ commit-message-incrementing: Enabled
ignore:
paths: []
sha: []
tags: []
increment: Inherit
is-main-branch: false
is-release-branch: false
Expand Down Expand Up @@ -210,7 +211,7 @@ update-build-number: true
version-bump-reset-message: "=semver:"
version-in-branch-pattern: "(?<version>[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
```
<sup><a href='/docs/workflows/GitFlow/v1.yml#L1-L168' title='Snippet source file'>snippet source</a> | <a href='#snippet-/docs/workflows/GitFlow/v1.yml' title='Start of snippet'>anchor</a></sup>
<sup><a href='/docs/workflows/GitFlow/v1.yml#L1-L169' title='Snippet source file'>snippet source</a> | <a href='#snippet-/docs/workflows/GitFlow/v1.yml' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

The supported built-in configuration for the `GitHubFlow` workflow (`workflow: GitHubFlow/v1`) looks like:
Expand Down Expand Up @@ -302,6 +303,7 @@ commit-message-incrementing: Enabled
ignore:
paths: []
sha: []
tags: []
increment: Inherit
is-main-branch: false
is-release-branch: false
Expand Down Expand Up @@ -336,7 +338,7 @@ update-build-number: true
version-bump-reset-message: "=semver:"
version-in-branch-pattern: "(?<version>[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
```
<sup><a href='/docs/workflows/GitHubFlow/v1.yml#L1-L117' title='Snippet source file'>snippet source</a> | <a href='#snippet-/docs/workflows/GitHubFlow/v1.yml' title='Start of snippet'>anchor</a></sup>
<sup><a href='/docs/workflows/GitHubFlow/v1.yml#L1-L118' title='Snippet source file'>snippet source</a> | <a href='#snippet-/docs/workflows/GitHubFlow/v1.yml' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

The preview built-in configuration (experimental usage only) for the `TrunkBased` workflow (`workflow: TrunkBased/preview1`) looks like:
Expand Down Expand Up @@ -417,6 +419,7 @@ commit-message-incrementing: Enabled
ignore:
paths: []
sha: []
tags: []
increment: Inherit
is-main-branch: false
is-release-branch: false
Expand Down Expand Up @@ -447,11 +450,19 @@ update-build-number: true
version-bump-reset-message: "=semver:"
version-in-branch-pattern: "(?<version>[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*"
```
<sup><a href='/docs/workflows/TrunkBased/preview1.yml#L1-L102' title='Snippet source file'>snippet source</a> | <a href='#snippet-/docs/workflows/TrunkBased/preview1.yml' title='Start of snippet'>anchor</a></sup>
<sup><a href='/docs/workflows/TrunkBased/preview1.yml#L1-L103' title='Snippet source file'>snippet source</a> | <a href='#snippet-/docs/workflows/TrunkBased/preview1.yml' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

The details of the available options are as follows:

:::{.alert .alert-info}
**Regular expression matching**

Unless stated otherwise, regular expressions in GitVersion configuration are
matched case-insensitively. To require case-sensitive matching, prefix the
expression with `(?-i)`, for example `(?-i)^experimental-`.
:::

### assembly-file-versioning-format

Specifies the format of `AssemblyFileVersion` and
Expand Down Expand Up @@ -691,8 +702,9 @@ A commit having changes only in `/ProjectB/*` path would be ignored. A commit ha
* `/ProductA/*` and `/ProductB/*` and `/LibraryC/*`

:::
Note: The `ignore.paths` configuration is case-sensitive.
This can lead to unexpected behavior on case-insensitive file systems, such as Windows. To ensure consistent matching regardless of case, you can prefix your regular expressions with the case-insensitive flag `(?i)`. For example, `(?i)^docs\/` will match both `docs/` and `Docs/`.
Note: The `ignore.paths` configuration is case-insensitive. To require
case-sensitive path matching, prefix the regular expression with `(?-i)`. For
example, `(?-i)^docs\/` matches `docs/` but not `Docs/`.
:::

::: {.alert .alert-warning}
Expand All @@ -719,6 +731,24 @@ ignore:
- 764e16321318f2fdb9cdeaa56d1156a1cba307d7
```

#### tags

A sequence of regular expressions matching tag names that should not be used as
[version sources][version-sources]. Patterns are matched case-insensitively
against the friendly tag name without the `refs/tags/` prefix. Multiple patterns
use OR semantics, and `^` and `$` can be used to anchor a match. To require
case-sensitive matching, prefix a pattern with `(?-i)`.

```yaml
ignore:
tags:
- ^experimental-
- ^v0\.
```

Ignoring a tag does not ignore the commit it points to. The commit remains part
of version calculation and can still be reached through other references.

### increment

The part of the SemVer to increment when GitVersion detects it needs to be
Expand Down
31 changes: 29 additions & 2 deletions docs/input/docs/reference/mdsource/configuration.source.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ snippet: /docs/workflows/TrunkBased/preview1.yml

The details of the available options are as follows:

:::{.alert .alert-info}
**Regular expression matching**

Unless stated otherwise, regular expressions in GitVersion configuration are
matched case-insensitively. To require case-sensitive matching, prefix the
expression with `(?-i)`, for example `(?-i)^experimental-`.
:::

### assembly-file-versioning-format

Specifies the format of `AssemblyFileVersion` and
Expand Down Expand Up @@ -289,8 +297,9 @@ A commit having changes only in `/ProjectB/*` path would be ignored. A commit ha
* `/ProductA/*` and `/ProductB/*` and `/LibraryC/*`

:::
Note: The `ignore.paths` configuration is case-sensitive.
This can lead to unexpected behavior on case-insensitive file systems, such as Windows. To ensure consistent matching regardless of case, you can prefix your regular expressions with the case-insensitive flag `(?i)`. For example, `(?i)^docs\/` will match both `docs/` and `Docs/`.
Note: The `ignore.paths` configuration is case-insensitive. To require
case-sensitive path matching, prefix the regular expression with `(?-i)`. For
example, `(?-i)^docs\/` matches `docs/` but not `Docs/`.
:::

::: {.alert .alert-warning}
Expand All @@ -317,6 +326,24 @@ ignore:
- 764e16321318f2fdb9cdeaa56d1156a1cba307d7
```

#### tags

A sequence of regular expressions matching tag names that should not be used as
[version sources][version-sources]. Patterns are matched case-insensitively
against the friendly tag name without the `refs/tags/` prefix. Multiple patterns
use OR semantics, and `^` and `$` can be used to anchor a match. To require
case-sensitive matching, prefix a pattern with `(?-i)`.

```yaml
ignore:
tags:
- ^experimental-
- ^v0\.
```

Ignoring a tag does not ignore the commit it points to. The commit remains part
of version calculation and can still be reached through other references.

### increment

The part of the SemVer to increment when GitVersion detects it needs to be
Expand Down
1 change: 1 addition & 0 deletions docs/input/docs/workflows/GitFlow/v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ commit-message-incrementing: Enabled
ignore:
paths: []
sha: []
tags: []
increment: Inherit
is-main-branch: false
is-release-branch: false
Expand Down
1 change: 1 addition & 0 deletions docs/input/docs/workflows/GitHubFlow/v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ commit-message-incrementing: Enabled
ignore:
paths: []
sha: []
tags: []
increment: Inherit
is-main-branch: false
is-release-branch: false
Expand Down
1 change: 1 addition & 0 deletions docs/input/docs/workflows/TrunkBased/preview1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ commit-message-incrementing: Enabled
ignore:
paths: []
sha: []
tags: []
increment: Inherit
is-main-branch: false
is-release-branch: false
Expand Down
26 changes: 15 additions & 11 deletions schemas/7.0/GitVersion.configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
},
"regex": {
"format": "regex",
"description": "The regular expression pattern to use to match this branch.",
"description": "The regular expression pattern to use to match this branch. Matching is case-insensitive by default; use (?-i) to enable case-sensitive matching.",
"type": [
"null",
"string"
Expand Down Expand Up @@ -195,12 +195,16 @@
]
},
"paths": {
"description": "A sequence of file paths to be excluded from the version calculations.",
"description": "A sequence of regular expressions matching file paths to be excluded from the version calculations. Matching is case-insensitive by default; use (?-i) to enable case-sensitive matching.",
"$ref": "#/$defs/hashSetOfString"
},
"sha": {
"description": "A sequence of SHAs to be excluded from the version calculations.",
"$ref": "#/$defs/hashSetOfString"
},
"tags": {
"description": "A sequence of regular expressions matching friendly tag names to be excluded as version sources. Matching is case-insensitive by default; use (?-i) to enable case-sensitive matching.",
"$ref": "#/$defs/hashSetOfString"
}
}
},
Expand Down Expand Up @@ -235,23 +239,23 @@
},
"major-version-bump-message": {
"format": "regex",
"description": "The regular expression to match commit messages with to perform a major version increment. Defaults to '[+=]semver:\\s?(breaking|major)'",
"description": "The regular expression to match commit messages with to perform a major version increment. Defaults to '[+=]semver:\\s?(breaking|major)'. Matching is case-insensitive by default; use (?-i) to enable case-sensitive matching.",
"default": "[+=]semver:\\s?(breaking|major)",
"type": [
"null",
"string"
]
},
"merge-message-formats": {
"description": "Custom merge message formats to enable identification of merge messages that do not follow the built-in conventions.",
"description": "Custom regular expression merge message formats to enable identification of merge messages that do not follow the built-in conventions. Matching is case-insensitive by default; use (?-i) to enable case-sensitive matching.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"minor-version-bump-message": {
"format": "regex",
"description": "The regular expression to match commit messages with to perform a minor version increment. Defaults to '[+=]semver:\\s?(feature|minor)'",
"description": "The regular expression to match commit messages with to perform a minor version increment. Defaults to '[+=]semver:\\s?(feature|minor)'. Matching is case-insensitive by default; use (?-i) to enable case-sensitive matching.",
"default": "[+=]semver:\\s?(feature|minor)",
"type": [
"null",
Expand All @@ -276,7 +280,7 @@
},
"no-bump-message": {
"format": "regex",
"description": "Used to tell GitVersion not to increment when in Mainline development mode. Defaults to '[+=]semver:\\s?(none|skip)'",
"description": "Used to tell GitVersion not to increment when in Mainline development mode. Defaults to '[+=]semver:\\s?(none|skip)'. Matching is case-insensitive by default; use (?-i) to enable case-sensitive matching.",
"default": "[+=]semver:\\s?(none|skip)",
"type": [
"null",
Expand All @@ -285,7 +289,7 @@
},
"patch-version-bump-message": {
"format": "regex",
"description": "The regular expression to match commit messages with to perform a patch version increment. Defaults to '[+=]semver:\\s?(fix|patch)'",
"description": "The regular expression to match commit messages with to perform a patch version increment. Defaults to '[+=]semver:\\s?(fix|patch)'. Matching is case-insensitive by default; use (?-i) to enable case-sensitive matching.",
"default": "[+=]semver:\\s?(fix|patch)",
"type": [
"null",
Expand All @@ -305,7 +309,7 @@
},
"regex": {
"format": "regex",
"description": "The regular expression pattern to use to match this branch.",
"description": "The regular expression pattern to use to match this branch. Matching is case-insensitive by default; use (?-i) to enable case-sensitive matching.",
"type": [
"null",
"string"
Expand Down Expand Up @@ -348,7 +352,7 @@
},
"tag-prefix": {
"format": "regex",
"description": "A regular expression which is used to trim Git tags before processing. Defaults to '[vV]?'",
"description": "A regular expression which is used to trim Git tags before processing. Defaults to '[vV]?'. Matching is case-insensitive by default; use (?-i) to enable case-sensitive matching.",
"default": "[vV]?",
"type": [
"null",
Expand Down Expand Up @@ -383,7 +387,7 @@
},
"version-bump-reset-message": {
"format": "regex",
"description": "The regular expression to match commit messages that reset the version bump baseline and suppress the configured branch increment. Defaults to '=semver:'",
"description": "The regular expression to match commit messages that reset the version bump baseline and suppress the configured branch increment. Defaults to '=semver:'. Matching is case-insensitive by default; use (?-i) to enable case-sensitive matching.",
"default": "=semver:",
"type": [
"null",
Expand All @@ -392,7 +396,7 @@
},
"version-in-branch-pattern": {
"format": "regex",
"description": "A regular expression which is used to determine the version number in the branch name or commit message (e.g., v1.0.0-LTS). Defaults to '(?<version>[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*'.",
"description": "A regular expression which is used to determine the version number in the branch name or commit message (e.g., v1.0.0-LTS). Defaults to '(?<version>[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*'. Matching is case-insensitive by default; use (?-i) to enable case-sensitive matching.",
"default": "(?<version>[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*",
"type": [
"null",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ commit-message-incrementing: Enabled
ignore:
paths: []
sha: []
tags: []
increment: Inherit
is-main-branch: false
is-release-branch: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,34 @@ public void ShouldSupportsOtherSequenceFormat()
configuration.Ignore.Shas.ShouldBe(["b6c0c9fda88830ebcd563e500a5a7da5a1658e98", "6c19c7c219ecf8dbc468042baefa73a1b213e8b1"]);
}

[Test]
public void CanDeserializeCompactTagsSequence()
{
const string yaml = "ignore:\n tags: ['^preview-', '^v0\\.']";

var configuration = this.serializer.ReadConfiguration(yaml);

configuration.ShouldNotBeNull();
configuration.Ignore.Tags.ShouldBe(["^preview-", "^v0\\."]);
}

[Test]
public void CanDeserializeMultilineTagsSequence()
{
const string yaml =
"""
ignore:
tags:
- ^preview-
- ^v0\.
""";

var configuration = this.serializer.ReadConfiguration(yaml);

configuration.ShouldNotBeNull();
configuration.Ignore.Tags.ShouldBe(["^preview-", "^v0\\."]);
}

[Test]
public void WhenNotInConfigShouldHaveDefaults()
{
Expand All @@ -60,6 +88,47 @@ public void WhenNotInConfigShouldHaveDefaults()
configuration.Ignore.Before.ShouldBe(null);
configuration.Ignore.Paths.ShouldBeEmpty();
configuration.Ignore.Shas.ShouldBeEmpty();
configuration.Ignore.Tags.ShouldBeEmpty();
}

[Test]
public void IsEmpty_WhenTagPatternIsConfigured_ReturnsFalse()
{
var ignoreConfig = new IgnoreConfiguration { Tags = ["^preview-"] };

ignoreConfig.IsEmpty.ShouldBeFalse();
}

[Test]
public void InvalidIgnoreTagExpression_ThrowsConfigurationExceptionWithPropertyAndPattern()
{
const string invalidExpression = "[invalid";

var exception = Should.Throw<ConfigurationException>(() => GitFlowConfigurationBuilder.New
.WithIgnoreConfiguration(new IgnoreConfiguration { Tags = [invalidExpression] })
.Build());

exception.Message.ShouldContain("ignore.tags");
exception.Message.ShouldContain(invalidExpression);
}

[Test]
public void Serialize_IgnoreTagPatterns_UsesTagsPropertyName()
{
var ignoreConfig = new IgnoreConfiguration { Tags = ["^preview-"] };

var yaml = this.serializer.Serialize(ignoreConfig);

yaml.ShouldContain("tags:");
yaml.ShouldContain("^preview-");
}

[Test]
public void IgnoreConfigurationBuilder_WithTags_PreservesCollection()
{
var ignoreConfig = IgnoreConfigurationBuilder.New.WithTags("^preview-", "^v0\\.").Build();

ignoreConfig.Tags.ShouldBe(["^preview-", "^v0\\."]);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ commit-message-incrementing: Enabled
ignore:
paths: []
sha: []
tags: []
increment: Inherit
is-main-branch: false
is-release-branch: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ commit-message-incrementing: Enabled
ignore:
paths: []
sha: []
tags: []
increment: Inherit
is-main-branch: false
is-release-branch: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ commit-message-incrementing: Enabled
ignore:
paths: []
sha: []
tags: []
increment: Inherit
is-main-branch: false
is-release-branch: false
Expand Down
Loading
Loading