summaryrefslogtreecommitdiffstats
path: root/src/config.rs
blob: f88167ce55670067e0f101478bcb6c02c0b73620 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
pub const MAX_STACK_CONFIG_NAME: &str = "absorb.maxStack";
pub const MAX_STACK: usize = 10;

pub fn max_stack(repo: &git2::Repository) -> usize {
    match repo
        .config()
        .and_then(|config| config.get_i64(MAX_STACK_CONFIG_NAME))
    {
        Ok(max_stack) if max_stack > 0 => max_stack as usize,
        _ => MAX_STACK,
    }
}