1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
mod ignore;
mod status;
mod status_computer;
pub use {
ignore::{GitIgnoreChain, GitIgnorer},
status::{LineGitStatus, LineStatusComputer, TreeGitStatus},
status_computer::{clear_status_computer_cache, get_tree_status},
};
use std::path::{Path, PathBuf};
pub fn closest_repo_dir(mut path: &Path) -> Option<PathBuf> {
loop {
let c = path.join(".git");
if c.exists() {
return Some(path.to_path_buf());
}
path = match path.parent() {
Some(path) => path,
None => {
return None;
}
};
}
}