SemanticVersionBuildMetaData Class

Summary

Holds the build metadata attached to a semantic version (commits-since-tag, branch, SHA, commit date, etc.).
Namespace
GitVersion
Interfaces
Base Types
  • IFormattable
graph BT Type-->Base0["IFormattable"] Type-.->Interface0["IEquatable<SemanticVersionBuildMetaData>"] Type["SemanticVersionBuildMetaData"] class Type type-node

Syntax

public sealed class SemanticVersionBuildMetaData : IFormattable, 
    IEquatable<SemanticVersionBuildMetaData>

Constructors

Name Summary
SemanticVersionBuildMetaData() Initializes a new empty build metadata instance.
SemanticVersionBuildMetaData(SemanticVersion, string, long?, string, string, string, DateTimeOffset?, long, VersionField, string) Initializes a new build metadata instance with all fields specified.
SemanticVersionBuildMetaData(SemanticVersionBuildMetaData) Initializes a new build metadata instance as a copy of buildMetaData.

Fields

Name Constant Value Summary
Empty
An empty build metadata instance with no fields set.
static

Properties

Name Value Summary
Branch string
Gets or initializes the name of the branch on which this version was calculated.
CommitDate DateTimeOffset?
Gets or initializes the date of the current commit.
CommitsSinceTag long?
Gets or initializes the number of commits since the last version tag.
CommitsSinceVersionSource long
Gets the number of commits since the version source (alias for VersionSourceDistance).
OtherMetaData string
Gets or initializes any additional free-form metadata included in the build metadata string.
Sha string
Gets or initializes the full SHA of the current commit.
ShortSha string
Gets or initializes the abbreviated SHA of the current commit.
UncommittedChanges long
Gets or initializes the number of uncommitted changes in the working tree.
VersionSourceDistance long
Gets or initializes the number of commits between the version source tag and the current commit.
VersionSourceIncrement VersionField
Gets or initializes the version field that was incremented relative to the version source.
VersionSourceSemVer SemanticVersion
Gets or initializes the semantic version of the source tag from which the version was calculated.
VersionSourceSha string
Gets or initializes the SHA of the source tag commit.

Methods

Name Value Summary
Equals(object) bool
Returns true when obj is a SemanticVersionBuildMetaData equal to this instance.
Equals(SemanticVersionBuildMetaData) bool
Returns true when this instance is equal to other by commit count, branch, and SHA.
GetHashCode() int
Returns a hash code based on commit count, branch, and SHA.
Parse(string) SemanticVersionBuildMetaData
Parses the build metadata string, returning Empty when the input is null or empty.
static
ToString() string
Returns the default build metadata string (commits-since-tag).
ToString(string, IFormatProvider?) string

b - Formats just the build number

s - Formats the build number and the Git Sha

f - Formats the full build metadata

ToString(string) string
Returns a string representation of this build metadata using the given format specifier.

Operators

Name Value Summary
implicit operator SemanticVersionBuildMetaData(string) SemanticVersionBuildMetaData
implicit operator string(SemanticVersionBuildMetaData) string
operator !=(SemanticVersionBuildMetaData, SemanticVersionBuildMetaData) bool
operator ==(SemanticVersionBuildMetaData, SemanticVersionBuildMetaData) bool

Extension Methods

Name Value Summary
NotNull<SemanticVersionBuildMetaData>(string) T
Throws ArgumentNullException when value is null; otherwise returns the value.
GitHub