This resolves the issue where cloning a repository would fail while trying to read a local config that hadn't been created. In the long term, commands should be able to set config overrides if needed (for example when passing --repository, the local config won't be in the current directory).
HM6QW3CYVZVXOM2K3OT7SQFQGJG3GCDLNYIYAUDEVSJCVCSUZ4CQC // Validate that the configuration sources are correctlet global_config = Global::parse_contents(&global_config_path, &global_config_contents)?;let local_config = Local::parse_contents(&local_config_path, &local_config_contents)?;
let mut config: Self = Figment::new().merge(Toml::string(&global_config_contents)).merge(Toml::string(&local_config_contents)).extract()?;
let mut layers = Figment::new();// 1. Global configlet global_config = match Global::read_contents(&global_config_path) {Ok(contents) => {// Parse the config (and make sure it's valid!)let global_config = Global::parse_contents(&global_config_path, &contents)?;// Add the configuration layer as a stringlayers = layers.merge(Toml::string(&contents));Some(global_config)}Err(error) => {warn!("Unable to read global config file: {error:#?}");None}};// 2. Local configlet local_config = match Local::read_contents(&local_config_path) {Ok(contents) => {// Parse the config (and make sure it's valid!)let local_config = Local::parse_contents(&local_config_path, &contents)?;// Add the configuration layer as a stringlayers = layers.merge(Toml::string(&contents));Some(local_config)}Err(error) => {warn!("Unable to read local config file: {error:#?}");None}};