namespace StabilityMatrix.Core.Models; /// /// Union of either Tag or Branch + CommitSha. /// public record GitVersion : IFormattable { public string? Tag { get; init; } public string? Branch { get; init; } public string? CommitSha { get; init; } /// public override string ToString() { if (!string.IsNullOrEmpty(Tag)) { return Tag; } if (!string.IsNullOrEmpty(Branch) && !string.IsNullOrEmpty(CommitSha)) { return $"{Branch}@{CommitSha[..7]}"; } if (!string.IsNullOrEmpty(Branch)) { return Branch; } return !string.IsNullOrEmpty(CommitSha) ? CommitSha[..7] : ""; } /// public string ToString(string? format, IFormatProvider? formatProvider) { return ToString(); } }