History

[gix-organize]: this version fails to detect any git repo

Sebastian Thiel committed 5 years ago

Commit 8802fa71 parent 20f76a51 file · +5 −5Browse files

Showing the changes to gitoxide-core/src (1 of 1 file). Show all

Unified · Split

gitoxide-core/src/organize.rs+5−5
@@ -30,11 +30,11 @@ where · 29 unmodified lines
30 <P as Progress>::SubProgress: Sync,30 <P as Progress>::SubProgress: Sync,
31{31{
32 progress.init(None, progress::count("filesystem items"));32 progress.init(None, progress::count("filesystem items"));
33 fn is_repository(path: &Path) -> bool {33 fn is_repository(path: &Path) -> Option<git_repository::Kind> {
34 if !(path.is_dir() && path.ends_with(".git")) {34 if !(path.is_dir() && path.ends_with(".git")) {
35 return false;35 return None;
36 }36 }
37 path.join("HEAD").is_file() && path.join("config").is_file()37 git_repository::path::is_git(&path).ok()
38 }38 }
39 fn into_workdir(git_dir: PathBuf) -> PathBuf {39 fn into_workdir(git_dir: PathBuf) -> PathBuf {
40 if git_repository::path::is_bare(&git_dir) {40 if git_repository::path::is_bare(&git_dir) {
@@ -67,8 +67,8 @@ where · 26 unmodified lines
67 let mut found_bare_repo = false;67 let mut found_bare_repo = false;
68 for entry in siblings.iter_mut().flatten() {68 for entry in siblings.iter_mut().flatten() {
69 let path = entry.path();69 let path = entry.path();
70 if is_repository(&path) {70 if let Some(kind) = is_repository(&path) {
71 let is_bare = git_repository::path::is_bare(&path);71 let is_bare = kind.is_bare();
72 entry.client_state = State { is_repo: true, is_bare };72 entry.client_state = State { is_repo: true, is_bare };
73 entry.read_children_path = None;73 entry.read_children_path = None;
74 74