A publisher: Git repo, imported shim baseline, three recorded changes.
(root: &Path, home: &Path)
| 63 | |
| 64 | /// A publisher: Git repo, imported shim baseline, three recorded changes. |
| 65 | fn setup_publisher(root: &Path, home: &Path) { |
| 66 | { |
| 67 | let git = git2::Repository::init(root).expect("init git"); |
| 68 | fs::write(root.join("tracked.txt"), b"tracked bytes\n").expect("write file"); |
| 69 | let mut index = git.index().expect("open index"); |
| 70 | index.add_path(Path::new("tracked.txt")).expect("stage"); |
| 71 | index.write().expect("write index"); |
| 72 | let tree_oid = index.write_tree().expect("write tree"); |
| 73 | let tree = git.find_tree(tree_oid).expect("find tree"); |
| 74 | let signature = git2::Signature::now("Test", "test@example.com").expect("signature"); |
| 75 | git.commit(Some("HEAD"), &signature, &signature, "initial", &tree, &[]) |
| 76 | .expect("commit"); |
| 77 | } |
| 78 | |
| 79 | assert_success( |
| 80 | &atomic(root, home, &["git", "import", "--no-vault"]), |
| 81 | "git import", |
| 82 | ); |
| 83 | assert_success( |
| 84 | &atomic(root, home, &["git", "shim", "reconcile"]), |
| 85 | "shim reconcile", |
| 86 | ); |
| 87 | |
| 88 | for (name, message) in [("a.txt", "one"), ("b.txt", "two"), ("c.txt", "three")] { |
| 89 | fs::write(root.join(name), format!("{message}\n")).expect("edit file"); |
| 90 | assert_success(&atomic(root, home, &["add", name]), "add"); |
| 91 | assert_success(&atomic(root, home, &["record", "-m", message]), "record"); |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | fn binding_id(root: &Path, _home: &Path) -> String { |
| 96 | let repo = atomic_repository::Repository::open_readonly(root).expect("open atomic"); |
no test coverage detected