MCPcopy Create free account
hub / github.com/github/gh-aw / IsMorePreciseVersion

Function IsMorePreciseVersion

pkg/semverutil/semverutil.go:146–153  ·  view source on GitHub ↗

IsMorePreciseVersion reports whether v1 should sort ahead of v2 in the action-version specificity ordering. Versions with more dot-separated components sort first (for example "v4.3.0" ahead of "v4"), and ties use lexicographic ordering. This is an ordering predicate, not a strict "more-precise-only

(v1, v2 string)

Source from the content-addressed store, hash-verified

144// "more-precise-only" check. No validation is performed; callers should ensure
145// both inputs are well-formed version tags.
146func IsMorePreciseVersion(v1, v2 string) bool {
147 dots1 := strings.Count(v1, ".")
148 dots2 := strings.Count(v2, ".")
149 if dots1 != dots2 {
150 return dots1 > dots2
151 }
152 return v1 > v2
153}
154
155// IsCompatible reports whether pinVersion is semver-compatible with requestedVersion.
156// Semver compatibility is defined as both versions sharing the same major version.

Callers 2

buildDedupKeyInfosFunction · 0.92
TestIsMorePreciseVersionFunction · 0.92

Calls 1

CountMethod · 0.45

Tested by 1

TestIsMorePreciseVersionFunction · 0.74