| 239 | } |
| 240 | |
| 241 | fn 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 | |
| 286 | fn make_bare_remote(temp: &TempDir) -> std::path::PathBuf { |
| 287 | let remote_dir = temp.path().join("remote.git"); |