]> source.dussan.org Git - gitblit.git/commitdiff
Adjust repository search to handle foo.git and foo/bar.git (issue 104)
authorJames Moger <james.moger@gitblit.com>
Wed, 11 Jul 2012 03:54:07 +0000 (23:54 -0400)
committerJames Moger <james.moger@gitblit.com>
Wed, 11 Jul 2012 03:54:07 +0000 (23:54 -0400)
docs/04_releases.mkd
src/com/gitblit/utils/JGitUtils.java
tests/com/gitblit/tests/JGitUtilsTest.java

index 048db6f7d74ae917ea87070c0df8a028cf30a63b..3c22dbe445b124e89cef76389bf1e8acdb3df4c1 100644 (file)
@@ -6,6 +6,7 @@
 \r
 #### fixes\r
 \r
+- Adjust repository search to handle foo.git and foo/bar.git (issue 104)\r
 - Fixed bug where a repository set as authenticated push did not have anonymous clone access (issue 96)\r
 - Fixed bug in Basic authentication if passwords had a colon (Github/peterloron)\r
 - Fixed bug where the Gitblit Manager could not update a setting that was not referenced in reference.properties (issue 85)\r
index 72a8ab3cb04f7a571fceaac007b6affb09933470..ab5b655b494f772fa7aa25ff43a272dab5bd5624 100644 (file)
@@ -309,9 +309,14 @@ public class JGitUtils {
                                        if (onlyBare && gitDir.getName().equals(".git")) {\r
                                                continue;\r
                                        }\r
-                                       // determine repository name relative to base path\r
-                                       String repository = FileUtils.getRelativePath(baseFile, file);\r
-                                       list.add(repository);\r
+                                       if (gitDir.equals(file) || gitDir.getParentFile().equals(file)) {\r
+                                               // determine repository name relative to base path\r
+                                               String repository = FileUtils.getRelativePath(baseFile, file);\r
+                                               list.add(repository);\r
+                                       } else if (searchSubfolders && file.canRead()) {\r
+                                               // look for repositories in subfolders\r
+                                               list.addAll(getRepositoryList(basePath, file, onlyBare, searchSubfolders));\r
+                                       }\r
                                } else if (searchSubfolders && file.canRead()) {\r
                                        // look for repositories in subfolders\r
                                        list.addAll(getRepositoryList(basePath, file, onlyBare, searchSubfolders));\r
index dc4d3c5016195cffe64480a31851a342c41e002e..316d136872e84a40df27e982b326df78650f7835 100644 (file)
@@ -71,7 +71,7 @@ public class JGitUtilsTest {
                assertEquals(0, list.size());\r
                list.addAll(JGitUtils.getRepositoryList(new File("DoesNotExist"), true, true));\r
                assertEquals(0, list.size());\r
-               list.addAll(JGitUtils.getRepositoryList(GitBlitSuite.REPOSITORIES, true, true));\r
+               list.addAll(JGitUtils.getRepositoryList(GitBlitSuite.REPOSITORIES, false, true));\r
                assertTrue("No repositories found in " + GitBlitSuite.REPOSITORIES, list.size() > 0);\r
        }\r
 \r