(root: &Path, home: &Path)
| 56 | } |
| 57 | |
| 58 | fn setup_fixture(root: &Path, home: &Path) { |
| 59 | { |
| 60 | let git = git2::Repository::init(root).expect("init Git"); |
| 61 | fs::write(root.join("tracked.txt"), b"tracked bytes\n").expect("write file"); |
| 62 | let mut index = git.index().expect("open index"); |
| 63 | index |
| 64 | .add_path(Path::new("tracked.txt")) |
| 65 | .expect("stage file"); |
| 66 | index.write().expect("write index"); |
| 67 | let tree_oid = index.write_tree().expect("write tree"); |
| 68 | let tree = git.find_tree(tree_oid).expect("find tree"); |
| 69 | let signature = git2::Signature::now("Test", "test@example.com").expect("signature"); |
| 70 | git.commit(Some("HEAD"), &signature, &signature, "initial", &tree, &[]) |
| 71 | .expect("commit"); |
| 72 | } |
| 73 | |
| 74 | // Import the Git history into Atomic and anchor the shim baseline. |
| 75 | let import = atomic(root, home, &["git", "import", "--no-vault"]); |
| 76 | assert_init(&import); |
| 77 | let reconcile = atomic(root, home, &["git", "shim", "reconcile"]); |
| 78 | assert_init(&reconcile); |
| 79 | |
| 80 | // Create a real recorded edit so a causal operation exists to bind. |
| 81 | fs::write(root.join("tracked.txt"), b"tracked bytes\nmore\n").expect("edit file"); |
| 82 | let add = atomic(root, home, &["add", "tracked.txt"]); |
| 83 | assert_init(&add); |
| 84 | let record = atomic(root, home, &["record", "-m", "record tracked file"]); |
| 85 | assert_init(&record); |
| 86 | } |
| 87 | |
| 88 | fn assert_init(output: &Output) { |
| 89 | assert!( |
no test coverage detected