Skip to content
Snippets Groups Projects
Verified Commit 0a13aedc authored by nfontrod's avatar nfontrod
Browse files

src/remote.rs: update remote with the new config

parent cfb6b9a4
Branches
No related tags found
Loading
......@@ -27,10 +27,12 @@ pub fn parse_config(global: bool) -> Config {
let config_file = get_optional_config(global);
let config_file = match config_file {
None => {
return Config {
gblk_prune: None,
gblk_remote: None,
};
if global {
return Config::new(global);
} else {
eprintln!("{}: local config should exists !", "error".red());
exit(1);
}
}
Some(c) => c,
};
......@@ -46,12 +48,15 @@ pub fn parse_config(global: bool) -> Config {
Ok(s) => s,
};
if content.is_empty() {
return Config {
gblk_prune: None,
gblk_remote: None,
};
if global {
return Config::new(global);
} else {
eprintln!("{}: local config should not be empty !", "error".red());
exit(1);
}
}
let config_str: Config = toml::from_str(&content).unwrap();
config_str.check_project_type(global, &config_file);
config_str
}
......@@ -106,7 +111,7 @@ fn get_remotes(global: bool) -> Option<Vec<RemoteConfig>> {
/// Get a dictionary of locally and globally defined remotes
/// # Return
/// A dictionary linking remote name and remote config globally and locally defined
/// A dictionary linking remote name and remote config globally and locally
pub(crate) fn get_dic_remotes() -> Dict<String, (RemoteConfig, String)> {
let remote_global = get_remotes(true);
let remote_local = get_remotes(false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment