MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / commit_git_paths

Function commit_git_paths

atomic-cli/tests/it/adaptation_regression_test.rs:31–45  ·  view source on GitHub ↗
(root: &Path, message: &str, paths: &[&str])

Source from the content-addressed store, hash-verified

29
30#[cfg(unix)]
31fn commit_git_paths(root: &Path, message: &str, paths: &[&str]) {
32 let git = git2::Repository::open(root).unwrap();
33 let mut index = git.index().unwrap();
34 index.clear().unwrap();
35 for path in paths {
36 index.add_path(Path::new(path)).unwrap();
37 }
38 index.write().unwrap();
39 let tree = git.find_tree(index.write_tree().unwrap()).unwrap();
40 let author = git2::Signature::now("Regression", "regression@example.test").unwrap();
41 let parent = git.head().ok().and_then(|head| head.peel_to_commit().ok());
42 let parents: Vec<_> = parent.iter().collect();
43 git.commit(Some("HEAD"), &author, &author, message, &tree, &parents)
44 .unwrap();
45}
46
47// Git shim integration currently requires Unix raw-byte path support.
48#[cfg(unix)]

Calls 11

openFunction · 0.85
clearMethod · 0.65
unwrapMethod · 0.45
indexMethod · 0.45
add_pathMethod · 0.45
writeMethod · 0.45
okMethod · 0.45
headMethod · 0.45
collectMethod · 0.45
iterMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected