From a4f2dee4f5a47da0a3b352d999043609dcce90a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Thu, 18 Nov 2021 11:21:27 +0100 Subject: [PATCH] find: Fix name detection at non-root level --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7c07e6b..e556901 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -240,7 +240,7 @@ fn find_repos_without_details(path: &Path) -> Option> { Some(repos) } -fn find_repos(root: &Path, at_root: bool) -> Option> { +fn find_repos(root: &Path) -> Option> { let mut repos: Vec = Vec::new(); for path in find_repos_without_details(root).unwrap() { @@ -321,7 +321,7 @@ fn find_repos(root: &Path, at_root: bool) -> Option> { }; repos.push(Repo { - name: match at_root { + name: match path == root { true => match &root.parent() { Some(parent) => path_as_string(path.strip_prefix(parent).unwrap()), None => { @@ -338,7 +338,7 @@ fn find_repos(root: &Path, at_root: bool) -> Option> { } fn find_in_tree(path: &Path) -> Option { - let repos: Vec = match find_repos(path, true) { + let repos: Vec = match find_repos(path) { Some(vec) => vec, None => Vec::new(), };