# Function cargo::sources::git::utils::rev_to_oid

source ·

    pub(super) fn rev_to_oid(rev: &str) -> Option<Oid>

Expand description

Turns a full commit hash revision into an oid.

Git object ID is supposed to be a hex string of 20 (SHA1) or 32 (SHA256) bytes. Its length must be double to the underlying bytes (40 or 64), otherwise libgit2 would happily zero-pad the returned oid.

See:

- https://github.com/rust-lang/cargo/issues/13188
- https://github.com/rust-lang/cargo/issues/13968