Skip to main content

git_resolve_ref

Function git_resolve_ref 

Source
pub fn git_resolve_ref(
    url: &str,
    committish: Option<&str>,
) -> Result<String, Error>
Expand description

Resolve a git ref (branch name, tag, or partial commit) to a full 40-char commit SHA by shelling out to git ls-remote. committish of None means resolve HEAD. An input that already looks like a full 40-char hex SHA is returned as-is without touching the network.

Matches the pnpm flow: try exact ref, then refs/tags/<ref>, refs/heads/<ref>, falling back to the HEAD of the repo when the caller passes None.