Function
get_commit_hash_default_impl
(repository_root_path: &str)
Source from the content-addressed store, hash-verified
| 184 | } |
| 185 | |
| 186 | fn get_commit_hash_default_impl(repository_root_path: &str) -> Result<String> { |
| 187 | let repo = Repository::open(repository_root_path).context(format!( |
| 188 | "Failed to open repository at path: {repository_root_path}" |
| 189 | ))?; |
| 190 | |
| 191 | let commit_hash = repo |
| 192 | .head() |
| 193 | .and_then(|head| head.peel_to_commit()) |
| 194 | .context("Failed to get HEAD commit")? |
| 195 | .id() |
| 196 | .to_string(); |
| 197 | Ok(commit_hash) |
| 198 | } |
| 199 | |
| 200 | #[cfg(test)] |
| 201 | mod tests { |