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

Function clone_project

src/git/mod.rs:118–135  ·  view source on GitHub ↗
(config: &Config, project: &Project, path: &Path)

Source from the content-addressed store, hash-verified

116}
117
118pub 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
137fn init_additional_remotes(project: &Project, repository: Repository) -> Result<(), AppError> {
138 if let Some(additional_remotes) = &project.additional_remotes {

Callers 1

sync_projectFunction · 0.85

Calls 6

builderFunction · 0.85
init_additional_remotesFunction · 0.85
spawn_maybeFunction · 0.85
random_colorFunction · 0.85
get_shell_or_defaultMethod · 0.80
resolve_after_cloneMethod · 0.80

Tested by

no test coverage detected