SemanticVersionBuildMetaData Class

Summary

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

Syntax

public sealed class SemanticVersionBuildMetaData : IFormattable, 
    IEquatable<SemanticVersionBuildMetaData>

Attributes

Type Description
NullableContextAttribute
NullableAttribute

Constructors

Name Summary
SemanticVersionBuildMetaData() Initializes a new empty build metadata instance.
SemanticVersionBuildMetaData(SemanticVersion, string, Nullable<long>, string, string, string, Nullable<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
CommitCountSourceDistance long
Gets the number of non-ignored commits reachable from HEAD but not from the counting anchor.
CommitCountSourceSha string
Gets the commit used as the anchor for counting, or null when counting all reachable history.

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.
get_Branch() string
get_CommitDate() Nullable<DateTimeOffset>
get_CommitsSinceTag() Nullable<long>
get_OtherMetaData() string
get_SemVerSourceIncrement() VersionField
get_SemVerSourceSemVer() SemanticVersion
get_SemVerSourceSha() string
get_Sha() string
get_ShortSha() string
get_UncommittedChanges() long
get_VersionSourceDistance() long
get_VersionSourceIncrement() VersionField
get_VersionSourceSemVer() SemanticVersion
get_VersionSourceSha() string
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
set_Branch()
set_CommitDate()
set_CommitsSinceTag()
set_OtherMetaData()
set_SemVerSourceIncrement()
set_SemVerSourceSemVer()
set_SemVerSourceSha()
set_Sha()
set_ShortSha()
set_UncommittedChanges()
set_VersionSourceDistance()
set_VersionSourceIncrement()
set_VersionSourceSemVer()
set_VersionSourceSha()
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 System.ArgumentNullException when value is null; otherwise returns the value.