Function
commit
(
git: &GitRepository,
files: &[(&str, &str)],
message: &str,
parent: Option<git2::Oid>,
)
Source from the content-addressed store, hash-verified
| 91 | } |
| 92 | |
| 93 | fn commit( |
| 94 | git: &GitRepository, |
| 95 | files: &[(&str, &str)], |
| 96 | message: &str, |
| 97 | parent: Option<git2::Oid>, |
| 98 | ) -> git2::Oid { |
| 99 | let tree = git.find_tree(write_tree(git, files)).unwrap(); |
| 100 | let signature = Signature::now("Vault Fixture", "vault@example.com").unwrap(); |
| 101 | let parents: Vec<_> = parent |
| 102 | .map(|oid| git.find_commit(oid).unwrap()) |
| 103 | .into_iter() |
| 104 | .collect(); |
| 105 | git.commit( |
| 106 | Some("refs/heads/main"), |
| 107 | &signature, |
| 108 | &signature, |
| 109 | message, |
| 110 | &tree, |
| 111 | &parents.iter().collect::<Vec<_>>(), |
| 112 | ) |
| 113 | .unwrap() |
| 114 | } |
| 115 | |
| 116 | /// Build a two-commit repository; `with_vault` controls whether the history |
| 117 | /// tracks custom `.vault/` content, and return its root and isolated HOME. |
Tested by
no test coverage detected