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

Function load_project

src/setup/mod.rs:151–169  ·  view source on GitHub ↗
(maybe_settings: Option<Settings>, path_to_repo: PathBuf, name: &str)

Source from the content-addressed store, hash-verified

149}
150
151fn load_project(maybe_settings: Option<Settings>, path_to_repo: PathBuf, name: &str) -> Result<Project, AppError> {
152 let repo: Repository = Repository::open(path_to_repo)?;
153 let remote = repo.find_remote("origin")?;
154 let url = remote
155 .url()
156 .ok_or_else(|| AppError::UserError(format!("invalid remote origin at {:?}", repo.path())))?;
157 Ok(Project {
158 name: name.to_owned(),
159 git: url.to_owned(),
160 after_clone: maybe_settings.clone().and_then(|s| s.default_after_clone),
161 after_workon: maybe_settings.clone().and_then(|s| s.default_after_workon),
162 override_path: None,
163 additional_remotes: None, // TODO: use remotes
164 tags: maybe_settings.and_then(|s| s.default_tags),
165 bare: None,
166 trusted: false,
167 project_config_path: "default".to_string(),
168 })
169}
170
171fn write_new_config_with_projects(projects: BTreeMap<String, Project>, workspace_dir: &str) -> Result<(), AppError> {
172 let settings: config::settings::PersistedSettings = config::settings::PersistedSettings {

Callers 2

determine_projectsFunction · 0.85
importFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected