(config: &Config, project: &Project, only_new: bool, ff_merge: bool)
| 22 | use std::os::unix::fs::FileTypeExt; |
| 23 | |
| 24 | fn 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 | |
| 39 | pub fn synchronize_metadata_if_trusted(project: &Project, path: &Path) -> Result<(), AppError> { |
| 40 | if !project.trusted { |
no test coverage detected