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)
| 327 | /// 6–64 hex characters: shorter prefixes are too ambiguous to index-match |
| 328 | /// against the attribution table. |
| 329 | fn 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 |