fn init_repo_dirs<P: AsRef<Path>>(repo_path: P) -> io::Result<()> {
    static DIRS: [&'static str; 4] = [
        "info",
        "objects",
        "refs",
        "refs/heads",
    ];
    for dir in DIRS.iter() {
        let mut buf = PathBuf::from(repo_path.as_ref());
        for component in dir.split("/") {
            buf.push(component);
        }
        let dirpath = buf.as_path();
        // TODO: More robust permissions and sanity checks.
        if !dirpath.exists() {
            fs::create_dir(dirpath)?;
        }
    }
    Ok(())
}
/// Create all the required directories for a minimal repository.
Create all the required directories for a minimal repository.
Create all the required directories for a minimal repository .
fn init_repo_dirs<P: AsRef<Path>>(repo_path: P) -> io::Result<()> {
    static DIRS: [&'static str; 4] = [
        "info",
        "objects",
        "refs",
        "refs/heads",
    ];
    for dir in DIRS.iter() {
        let mut buf = PathBuf::from(repo_path.as_ref());
        for component in dir.split("/") {
            buf.push(component);
        }
        let dirpath = buf.as_path();
        // TODO: More robust permissions and sanity checks.
        if !dirpath.exists() {
            fs::create_dir(dirpath)?;
        }
    }
    Ok(())
}
fn init_repo_dirs < P : AsRef < Path > > ( repo_path : P ) -> io :: Result < ( ) > { static DIRS : [ & ' static str ; 4 ] = [ " " , " " , " " , " " , ] ; for dir in DIRS . iter ( ) { let mut buf = PathBuf :: from ( repo_path . as_ref ( ) ) ; for component in dir . split ( " " ) { buf . push ( component ) ; } let dirpath = buf . as_path ( ) ; // TODO: More robust permissions and sanity checks. if ! dirpath . exists ( ) { fs :: create_dir ( dirpath ) ? ; } } Ok ( ( ) ) }
Create all the required directories for a minimal repository.
Create all the required directories for a minimal repository .
repo_path
P
repo_path
P