mit_commit_message_lints/mit/cmd/
get_config_non_clean_behaviour.rs

1//! Get rebase behavior for author trailers
2use miette::Result;
3
4use crate::{external::Vcs, mit::lib::non_clean_behaviour::BehaviourOption};
5
6/// # Errors
7///
8/// On failure to parse the behavior from the git config
9pub fn get_config_non_clean_behaviour(store: &dyn Vcs) -> Result<BehaviourOption> {
10    let behaviour_opt = store.get_str("mit.author.non-clean-behaviour")?;
11
12    if let Some(behaviour_str) = behaviour_opt {
13        let behaviour: BehaviourOption = behaviour_str.parse()?;
14
15        return Ok(behaviour);
16    }
17    Ok(BehaviourOption::AddTo)
18}