(git_dir: PathBuf, commit: String)
| 27 | } |
| 28 | |
| 29 | pub fn from_commit(git_dir: PathBuf, commit: String) -> Result<Self> { |
| 30 | let repo: gix::ThreadSafeRepository = gix::open(&git_dir) |
| 31 | .context("failed to open git repository")? |
| 32 | .into(); |
| 33 | let path_to_oid = if commit.is_empty() { |
| 34 | HashMap::new() |
| 35 | } else { |
| 36 | build_path_to_oid(&git_dir, &commit)? |
| 37 | }; |
| 38 | Ok(Self { |
| 39 | repo, |
| 40 | pending: HashMap::new(), |
| 41 | path_to_oid, |
| 42 | }) |
| 43 | } |
| 44 | |
| 45 | /// Create a commit from all pending blobs, consuming self. |
| 46 | /// |
nothing calls this directly
no test coverage detected