MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / parse_commit_sha

Function parse_commit_sha

src/sessions/git_correlation.rs:329–337  ·  view source on GitHub ↗

Validates and lowercases a (possibly abbreviated) commit sha. Requires 6–64 hex characters: shorter prefixes are too ambiguous to index-match against the attribution table.

(value: &str)

Source from the content-addressed store, hash-verified

327/// 6–64 hex characters: shorter prefixes are too ambiguous to index-match
328/// against the attribution table.
329fn parse_commit_sha(value: &str) -> Result<String, GitCorrelationError> {
330 let ok = (6..=64).contains(&value.len()) && value.chars().all(|c| c.is_ascii_hexdigit());
331 if !ok {
332 return Err(GitCorrelationError::InvalidArgument(
333 "commit must be 6-64 hexadecimal characters".to_string(),
334 ));
335 }
336 Ok(value.to_ascii_lowercase())
337}
338
339/// True when an observation at `ts` should extend a span covering
340/// `[first_ts, last_ts]` (same session/branch/worktree assumed) instead of

Callers 2

parseMethod · 0.85
from_argsMethod · 0.85

Calls 1

containsMethod · 0.45

Tested by

no test coverage detected