MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / transfer_to_client

Function transfer_to_client

atomic-cli/tests/it/git_binding_cb6c_test.rs:241–284  ·  view source on GitHub ↗
(publisher: &Path, remote_dir: &Path, client: &Path)

Source from the content-addressed store, hash-verified

239}
240
241fn transfer_to_client(publisher: &Path, remote_dir: &Path, client: &Path) {
242 let run_git = |dir: &Path, args: &[&str], context: &str| {
243 let out = Command::new("git")
244 .args(args)
245 .current_dir(dir)
246 .output()
247 .unwrap_or_else(|error| panic!("{context}: {error}"));
248 assert!(
249 out.status.success(),
250 "{context} failed: {}",
251 output_text(&out)
252 );
253 };
254 run_git(
255 publisher,
256 &[
257 "push",
258 remote_dir.to_str().unwrap(),
259 "refs/heads/*:refs/heads/*",
260 "refs/atomic/bindings/*:refs/atomic/bindings/*",
261 ],
262 "push branch + binding namespace",
263 );
264 run_git(
265 publisher.parent().unwrap(),
266 &[
267 "clone",
268 remote_dir.to_str().unwrap(),
269 client.file_name().unwrap().to_str().unwrap(),
270 ],
271 "clone to client",
272 );
273 run_git(
274 client,
275 &[
276 "config",
277 "--add",
278 "remote.origin.fetch",
279 "+refs/atomic/bindings/*:refs/atomic/bindings/*",
280 ],
281 "configure binding fetch refspec",
282 );
283 run_git(client, &["fetch", "origin"], "fetch binding refs");
284}
285
286fn make_bare_remote(temp: &TempDir) -> std::path::PathBuf {
287 let remote_dir = temp.path().join("remote.git");

Calls 5

parentMethod · 0.80
run_gitFunction · 0.70
outputMethod · 0.45
unwrapMethod · 0.45
file_nameMethod · 0.45

Tested by

no test coverage detected