//! gleisbau generate clear git graphs arranged for your branching model.
//!
//! The main steps are:
//! 1. Read branching model configuration (See [config] and [settings])
//! 2. Lay out the graph structure according to the branching model (See [graph])
//! 3. Render the layout to text or SVG (See [mod@print])

// Configure clippy to look for complex functions
#![warn(clippy::cognitive_complexity)]
#![warn(clippy::too_many_lines)]

pub use git2::Repository;
use std::path::Path;

pub mod backend;
pub mod config;
pub mod graph;
pub mod layout;
pub mod print;
pub mod settings;
pub mod track;
pub mod u32_index;

// Documentation only module,
// see https://rustprojectprimer.com/documentation/rustdoc.html
pub mod _0_7_x_refactor {
    #![doc = include_str!("../docs/refactoring.md")]
}

// Documentation only module,
// see https://rustprojectprimer.com/documentation/rustdoc.html
pub mod _0_7_x_algorithm {
    #![doc = include_str!("../docs/algorithm_2.md")]
}

pub fn get_repo<P: AsRef<Path>>(
    path: P,
    skip_repo_owner_validation: bool,
) -> Result<Repository, git2::Error> {
    if skip_repo_owner_validation {
        unsafe { git2::opts::set_verify_owner_validation(false)? }
    }
    Repository::discover(path)
}
