The tagged Git hash algorithm for a commit SHA, by digest width.
(sha: &str)
| 1739 | |
| 1740 | /// The tagged Git hash algorithm for a commit SHA, by digest width. |
| 1741 | pub(crate) fn git_algorithm_for_sha(sha: &str) -> CliResult<GitHashAlgorithm> { |
| 1742 | match sha.len() { |
| 1743 | 40 => Ok(GitHashAlgorithm::Sha1), |
| 1744 | 64 => Ok(GitHashAlgorithm::Sha256), |
| 1745 | other => Err(git_error(format!( |
| 1746 | "cannot classify Git hash algorithm for {other}-character SHA '{sha}'" |
| 1747 | ))), |
| 1748 | } |
| 1749 | } |
| 1750 | |
| 1751 | /// Explicit Git closure boundaries for one import (CB-9A §7). |
| 1752 | /// |
no test coverage detected