(config: &Config, project: &Project, path: &Path)
| 116 | } |
| 117 | |
| 118 | pub fn clone_project(config: &Config, project: &Project, path: &Path) -> Result<(), AppError> { |
| 119 | let shell = config.settings.get_shell_or_default(); |
| 120 | let mut repo_builder = builder(); |
| 121 | repo_builder |
| 122 | .bare(project.bare.unwrap_or_default()) |
| 123 | .clone(project.git.as_str(), path) |
| 124 | .map_err(AppError::GitError) |
| 125 | .and_then(|repo| init_additional_remotes(project, repo)) |
| 126 | .and_then(|_| { |
| 127 | let after_clone = config.resolve_after_clone(project); |
| 128 | if !after_clone.is_empty() { |
| 129 | spawn_maybe(&shell, &after_clone.join(" && "), path, &project.name, random_color()) |
| 130 | .map_err(|error| AppError::UserError(format!("Post-clone hook failed (nonzero exit code). Cause: {:?}", error))) |
| 131 | } else { |
| 132 | Ok(()) |
| 133 | } |
| 134 | }) |
| 135 | } |
| 136 | |
| 137 | fn init_additional_remotes(project: &Project, repository: Repository) -> Result<(), AppError> { |
| 138 | if let Some(additional_remotes) = &project.additional_remotes { |
no test coverage detected