pub fn create_branch(repo_path: &str, name: &str) -> Result<()> {
    scope_time!("create_branch");

    let repo = utils::repo(repo_path)?;

    let head_id = get_head_repo(&repo)?;
    let head_commit = repo.find_commit(head_id.into())?;

    let branch = repo.branch(name, &head_commit, false)?;
    let branch_ref = branch.into_reference();
    let branch_ref_name =
        String::from_utf8(branch_ref.name_bytes().to_vec())?;
    repo.set_head(branch_ref_name.as_str())?;

    Ok(())
}
/// creates a new branch pointing to current HEAD commit and updating HEAD to new branch
creates a new branch pointing to current HEAD commit and updating HEAD to new branch
creates a new branch pointing to current HEAD commit and updating HEAD to new branch
pub fn create_branch(repo_path: &str, name: &str) -> Result<()> {
    scope_time!("create_branch");
    let repo = utils::repo(repo_path)?;
    let head_id = get_head_repo(&repo)?;
    let head_commit = repo.find_commit(head_id.into())?;
    let branch = repo.branch(name, &head_commit, false)?;
    let branch_ref = branch.into_reference();
    let branch_ref_name =
        String::from_utf8(branch_ref.name_bytes().to_vec())?;
    repo.set_head(branch_ref_name.as_str())?;
    Ok(())
}
pub fn create_branch ( repo_path : & str , name : & str ) -> Result < ( ) > { scope_time ! ( " " ) ; let repo = utils :: repo ( repo_path ) ? ; let head_id = get_head_repo ( & repo ) ? ; let head_commit = repo . find_commit ( head_id . into ( ) ) ? ; let branch = repo . branch ( name , & head_commit , false ) ? ; let branch_ref = branch . into_reference ( ) ; let branch_ref_name = String :: from_utf8 ( branch_ref . name_bytes ( ) . to_vec ( ) ) ? ; repo . set_head ( branch_ref_name . as_str ( ) ) ? ; Ok ( ( ) ) }
creates a new branch pointing to current HEAD commit and updating HEAD to new branch
creates a new branch pointing to current HEAD commit and updating HEAD to new branch
repo_path
&str
name
&str
repo_path
&str
name
&str