Provision an agent's private working tree as a copy-on-write clone of this repository's working tree. Copies every tracked-or-untracked working file into `dest`, reflinking where the filesystem supports it (so unchanged blocks are shared on disk) and falling back to a plain copy otherwise. The `.atomic/` directory is **never** cloned — the sandbox shares the canonical graph via [`Repository::open
(
&self,
dest: P,
view: &str,
)
| 180 | /// commands run inside the sandbox resolve to this repository's canonical |
| 181 | /// graph and the given `view`. |
| 182 | pub fn provision_sandbox<P: AsRef<Path>>( |
| 183 | &self, |
| 184 | dest: P, |
| 185 | view: &str, |
| 186 | ) -> Result<usize, RepositoryError> { |
| 187 | let dest = dest.as_ref(); |
| 188 | let count = provision_working_tree(&self.root, dest)?; |
| 189 | |
| 190 | let pointer = SandboxPointer { |
| 191 | canonical: self.root.clone(), |
| 192 | view: view.to_string(), |
| 193 | }; |
| 194 | let bytes = serde_json::to_vec_pretty(&pointer) |
| 195 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 196 | std::fs::write(dest.join(SANDBOX_POINTER), bytes)?; |
| 197 | |
| 198 | Ok(count) |
| 199 | } |
| 200 | |
| 201 | /// Materialize a view's visible file content into `dir` (created if needed). |
| 202 | /// |