| 76 | |
| 77 | impl Colocated { |
| 78 | fn new(name: &str) -> Self { |
| 79 | let root = TempDir::new().expect("repo tempdir"); |
| 80 | let home = TempDir::new().expect("home tempdir"); |
| 81 | assert!(git(root.path(), &["init", "-q", "-b", "main"]) |
| 82 | .status |
| 83 | .success()); |
| 84 | fs::write(root.path().join("tracked.txt"), b"anchor me\n").expect("write file"); |
| 85 | assert!(git(root.path(), &["add", "tracked.txt"]).status.success()); |
| 86 | assert!(git(root.path(), &["commit", "-qm", "anchor base"]) |
| 87 | .status |
| 88 | .success()); |
| 89 | atomic_ok(root.path(), home.path(), &["init", "--no-vault"]); |
| 90 | fs::remove_file(root.path().join(".atomicignore")).expect("remove atomicignore"); |
| 91 | atomic_ok(root.path(), home.path(), &["git", "import", "--no-vault"]); |
| 92 | atomic_ok( |
| 93 | root.path(), |
| 94 | home.path(), |
| 95 | &[ |
| 96 | "git", |
| 97 | "shim", |
| 98 | "enable", |
| 99 | "--binding-key-file", |
| 100 | key_file(home.path()).to_str().expect("utf8 key path"), |
| 101 | ], |
| 102 | ); |
| 103 | // CB-10A: establish the Synchronized baseline mapping for the main |
| 104 | // view. The reconcile also proves the whole five-layer state. |
| 105 | atomic_ok(root.path(), home.path(), &["git", "shim", "reconcile"]); |
| 106 | let _ = name; |
| 107 | Self { root, home } |
| 108 | } |
| 109 | |
| 110 | fn root(&self) -> &Path { |
| 111 | self.root.path() |