diff --git a/libimagstorestdhook/src/vcs/git/config.rs b/libimagstorestdhook/src/vcs/git/config.rs index 839a57d6..726f4ddc 100644 --- a/libimagstorestdhook/src/vcs/git/config.rs +++ b/libimagstorestdhook/src/vcs/git/config.rs @@ -13,3 +13,22 @@ pub fn commit_message(config: &Value, action: StoreAction) -> Option { unimplemented!() } } + +pub fn abort_on_repo_init_err(cfg: Option<&Value>) -> bool { + cfg.map(|cfg| { + match cfg.lookup("abort_on_repo_init_failure") { + Some(&Value::Boolean(b)) => b, + Some(_) => { + warn!("Configuration error, 'abort_on_repo_init_failure' must be a Boolean (true|false)."); + warn!("Assuming 'true' now."); + true + }, + None => { + debug!("No key `abort_on_repo_init_failure' - Assuming 'true'"); + true + }, + } + }) + .unwrap_or(false) +} +