use crate::{bare::GitBare, cmd::oid::ObjectId, errors::GitResult};

pub struct BranchForkParams {
    pub name: String,
    pub oid: ObjectId,
    pub force: bool,
}

impl GitBare {
    pub fn branch_fork(&self, params: &BranchForkParams) -> GitResult<()> {
        let mut args = vec!["branch".to_string()];
        if params.force {
            args.push("--force".to_string());
        }
        args.push(params.name.clone());
        args.push(params.oid.to_string());
        self.git_command_trusted(args)?;
        Ok(())
    }
}
