Skip to main content

is_full_sha

Function is_full_sha 

Source
pub fn is_full_sha(s: &str) -> bool
Expand description

Whether s is a 40-character hex string — a git commit SHA shape, shared by every ecosystem resolving refs against a git-tags-datasource API (GitHub, GitLab).

§Examples

use deps_core::lsp_helpers::is_full_sha;

assert!(is_full_sha(&"a".repeat(40)));
assert!(!is_full_sha(&"a".repeat(39)));
assert!(!is_full_sha("not-a-sha"));