MCPcopy Create free account
hub / github.com/brocode/fw / sync_project

Function sync_project

src/sync/mod.rs:24–37  ·  view source on GitHub ↗
(config: &Config, project: &Project, only_new: bool, ff_merge: bool)

Source from the content-addressed store, hash-verified

22use std::os::unix::fs::FileTypeExt;
23
24fn sync_project(config: &Config, project: &Project, only_new: bool, ff_merge: bool) -> Result<(), AppError> {
25 let path = config.actual_path_to_project(project);
26 let exists = path.exists();
27 let result = if exists {
28 if only_new {
29 Ok(())
30 } else {
31 update_project_remotes(project, &path, ff_merge).and_then(|_| synchronize_metadata_if_trusted(project, &path))
32 }
33 } else {
34 clone_project(config, project, &path).and_then(|_| synchronize_metadata_if_trusted(project, &path))
35 };
36 result.map_err(|e| AppError::RuntimeError(format!("Failed to sync {}: {}", project.name, e)))
37}
38
39pub fn synchronize_metadata_if_trusted(project: &Project, path: &Path) -> Result<(), AppError> {
40 if !project.trusted {

Callers 1

synchronizeFunction · 0.85

Calls 4

update_project_remotesFunction · 0.85
clone_projectFunction · 0.85

Tested by

no test coverage detected