| 105 | |
| 106 | impl Colocated { |
| 107 | fn new() -> Self { |
| 108 | let root = TempDir::new().expect("repo tempdir"); |
| 109 | let home = TempDir::new().expect("home tempdir"); |
| 110 | assert!(git_ok(&root, &["init", "-q", "-b", "main"])); |
| 111 | fs::write(root.path().join("tracked.txt"), b"anchor me\n").expect("write file"); |
| 112 | assert!(git_ok(&root, &["add", "tracked.txt"])); |
| 113 | assert!(git_ok(&root, &["commit", "-qm", "anchor base"])); |
| 114 | atomic_ok(root.path(), home.path(), &["init", "--no-vault"]); |
| 115 | fs::remove_file(root.path().join(".atomicignore")).expect("remove atomicignore"); |
| 116 | atomic_ok(root.path(), home.path(), &["git", "import", "--no-vault"]); |
| 117 | atomic_ok( |
| 118 | root.path(), |
| 119 | home.path(), |
| 120 | &[ |
| 121 | "git", |
| 122 | "shim", |
| 123 | "enable", |
| 124 | "--binding-key-file", |
| 125 | key_file(home.path()).to_str().expect("utf8 key path"), |
| 126 | ], |
| 127 | ); |
| 128 | atomic_ok(root.path(), home.path(), &["git", "shim", "reconcile"]); |
| 129 | Self { root, home } |
| 130 | } |
| 131 | |
| 132 | fn root(&self) -> &Path { |
| 133 | self.root.path() |