From 23600183b80713d7c87300316de0b06596d673e3 Mon Sep 17 00:00:00 2001 From: James Moger Date: Tue, 10 Jul 2012 23:54:07 -0400 Subject: Adjust repository search to handle foo.git and foo/bar.git (issue 104) --- src/com/gitblit/utils/JGitUtils.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java index 72a8ab3c..ab5b655b 100644 --- a/src/com/gitblit/utils/JGitUtils.java +++ b/src/com/gitblit/utils/JGitUtils.java @@ -309,9 +309,14 @@ public class JGitUtils { if (onlyBare && gitDir.getName().equals(".git")) { continue; } - // determine repository name relative to base path - String repository = FileUtils.getRelativePath(baseFile, file); - list.add(repository); + if (gitDir.equals(file) || gitDir.getParentFile().equals(file)) { + // determine repository name relative to base path + String repository = FileUtils.getRelativePath(baseFile, file); + list.add(repository); + } else if (searchSubfolders && file.canRead()) { + // look for repositories in subfolders + list.addAll(getRepositoryList(basePath, file, onlyBare, searchSubfolders)); + } } else if (searchSubfolders && file.canRead()) { // look for repositories in subfolders list.addAll(getRepositoryList(basePath, file, onlyBare, searchSubfolders)); -- cgit v1.2.3