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

Function write_atomic_gitlink

atomic-repository/src/repository/operation.rs:5092–5109  ·  view source on GitHub ↗
(path: &Path, object_id: &[u8], mode: u32)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 7

write_new_syncedFunction · 0.85
sync_directoryFunction · 0.85
parentMethod · 0.80
set_modeFunction · 0.70
prefixMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected