(path: &Path, object_id: &[u8], mode: u32)
| 5086 | } |
| 5087 | |
| 5088 | fn write_atomic_gitlink(path: &Path, object_id: &[u8], mode: u32) -> Result<(), RepositoryError> { |
| 5089 | let parent = path |
| 5090 | .parent() |
| 5091 | .ok_or_else(|| RepositoryError::InvalidOperation { |
| 5092 | message: format!("cannot replace gitlink without parent: {}", path.display()), |
| 5093 | })?; |
| 5094 | fs::create_dir_all(parent)?; |
| 5095 | let staging = tempfile::Builder::new() |
| 5096 | .prefix(".atomic-gitlink-") |
| 5097 | .tempdir_in(parent)?; |
| 5098 | let prepared = staging.path().join(BACKUP_VALUE); |
| 5099 | fs::create_dir(&prepared)?; |
| 5100 | write_new_synced(&prepared.join(".git"), object_id)?; |
| 5101 | set_mode(&prepared, mode)?; |
| 5102 | remove_filesystem_effect_path(path)?; |
| 5103 | fs::rename(&prepared, path)?; |
| 5104 | sync_directory(parent) |
| 5105 | } |
| 5106 | |
| 5107 | fn write_atomic_regular_from_file( |
| 5108 | path: &Path, |
no test coverage detected