Skip to main content

anodizer_core/config/
git_config.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4// ---------------------------------------------------------------------------
5// GitConfig
6// ---------------------------------------------------------------------------
7
8/// Git-level tag discovery and sorting settings.
9///
10/// Controls how anodizer discovers and orders tags when determining the current
11/// and previous versions. This is separate from `TagConfig`, which controls
12/// version *bumping* logic.
13#[derive(Debug, Clone, Serialize, Deserialize, Default, JsonSchema)]
14#[serde(default, deny_unknown_fields)]
15pub struct GitConfig {
16    /// How to sort git tags when determining the latest version.
17    ///
18    /// Accepted values:
19    /// - `"-version:refname"` (default) — lexicographic version sort on the tag name.
20    /// - `"-version:creatordate"` — sort by the tag's creation date (newest first).
21    /// - `"semver"` — strict SemVer 2.0.0 ordering computed in Rust; prereleases
22    ///   sort below their release per spec section 11. Bypasses git's native sort.
23    /// - `"smartsemver"` — same ordering as `"semver"`, but when the current
24    ///   version (resolved from the template `Version` variable) is non-prerelease,
25    ///   prerelease tags are filtered out before previous-tag selection. Prevents
26    ///   `v0.2.0-beta.3` from being picked as the predecessor of `v0.2.0` (which
27    ///   would otherwise produce an empty changelog).
28    pub tag_sort: Option<String>,
29    /// Tag patterns to ignore during version detection (supports templates).
30    /// Tags matching any pattern in this list are excluded from version
31    /// detection entirely.
32    pub ignore_tags: Option<Vec<String>>,
33    /// Tag prefixes to ignore during version detection (supports templates).
34    /// Tags starting with any prefix in this list are excluded.
35    /// The ignore-tag-prefixes feature.
36    pub ignore_tag_prefixes: Option<Vec<String>>,
37    /// Suffix that identifies pre-release tags for sorting purposes.
38    /// When set, tags ending with this suffix are treated as pre-releases
39    /// and sorted accordingly during tag discovery.
40    pub prerelease_suffix: Option<String>,
41}