pub fn resolve_committish(committish: &str) -> Result<String>Expand description
Resolves a committish reference to a full SHA-1 hash and verifies the commit exists.
This function takes any valid Git committish (commit hash, branch name, tag, or
relative reference like HEAD~3) and resolves it to the full 40-character SHA-1
hash of the underlying commit object. It also validates that the commit object
actually exists in the repository.
§Arguments
committish- A Git committish reference (e.g., “HEAD”, “main”, “a1b2c3d”, “HEAD~3”)
§Returns
Ok(String)- The full SHA-1 hash of the resolved commitErr- If the committish cannot be resolved or the commit does not exist
§Examples
let sha = resolve_committish("HEAD").unwrap();
assert_eq!(sha.len(), 40); // Full SHA-1 hash