pub fn resolve_component_pin(
pin: &PinStyle,
raw: &str,
releases: &[GitlabCiVersion],
) -> Option<GitlabCiVersion>Expand description
Resolves raw (a component: pin, already classified as pin) against releases.
releases must be the project’s published CI/CD Catalog releases (spec FR-007’s
priority order: SHA > exact release > branch > ~latest > partial semver). A tag that
exists in the repository but was never published as a release is never a
candidate here — releases must already be the /releases response, never
/repository/tags (FR-004).
Returns None when nothing in releases matches — the honest “unresolvable” outcome for
a PinStyle::Branch pin, or for any pin naming a release/commit that doesn’t exist.
§Examples
use deps_gitlab_ci::PinStyle;
use deps_gitlab_ci::component::resolve_component_pin;
use deps_gitlab_ci::GitlabCiVersion;
let releases = vec![GitlabCiVersion {
version: "1.2.0".into(),
sha: "a".repeat(40),
prerelease: false,
published_at: None,
}];
let resolved = resolve_component_pin(&PinStyle::Tag, "1.2.0", &releases).unwrap();
assert_eq!(resolved.version.as_str(), "1.2.0");