Add helper to check config whether to abort the hook failing
This helper can be used to check the configuration of the hook whether it should abort if the repository cannot be opened.
This commit is contained in:
parent
af089952c8
commit
4436a294e2
1 changed files with 19 additions and 0 deletions
|
@ -13,3 +13,22 @@ pub fn commit_message(config: &Value, action: StoreAction) -> Option<String> {
|
||||||
unimplemented!()
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue