/// Look up from the `target` to find the project root directory based on it having a `.git` child.
Look up from the `target` to find the project root directory based on it having a `.git` child.
Look up from the ` target ` to find the project root directory based on it having a ` . git ` child .
fn project_root(target: &Path) -> Option<PathBuf> {
    let directory = std::fs::read_dir(target).unwrap();
    for file in directory {
        let file = file.unwrap();
        if file.file_name() == ".git" {
            return Some(file.path().with_file_name(""));
        }
    }
    if let Some(parent) = target.parent() {
        return project_root(parent);
    }
    None
}
fn project_root ( target : & Path ) -> Option < PathBuf > { let directory = std :: fs :: read_dir ( target ) . unwrap ( ) ; for file in directory { let file = file . unwrap ( ) ; if file . file_name ( ) == " " { return Some ( file . path ( ) . with_file_name ( " " ) ) ; } } if let Some ( parent ) = target . parent ( ) { return project_root ( parent ) ; } None }
Look up from the `target` to find the project root directory based on it having a `.git` child.
Look up from the ` target ` to find the project root directory based on it having a ` . git ` child .
target
&Path