diff options
author | James Moger <james.moger@gitblit.com> | 2012-07-10 23:54:07 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2012-07-10 23:54:07 -0400 |
commit | 23600183b80713d7c87300316de0b06596d673e3 (patch) | |
tree | 1e82a4ebd1f4cd5c9329f9b37070fd59cfa10023 | |
parent | 3fb41fdec5712b792da05e8549c2c0a31f112ca0 (diff) | |
download | gitblit-23600183b80713d7c87300316de0b06596d673e3.tar.gz gitblit-23600183b80713d7c87300316de0b06596d673e3.zip |
Adjust repository search to handle foo.git and foo/bar.git (issue 104)
-rw-r--r-- | docs/04_releases.mkd | 1 | ||||
-rw-r--r-- | src/com/gitblit/utils/JGitUtils.java | 11 | ||||
-rw-r--r-- | tests/com/gitblit/tests/JGitUtilsTest.java | 2 |
3 files changed, 10 insertions, 4 deletions
diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd index 048db6f7..3c22dbe4 100644 --- a/docs/04_releases.mkd +++ b/docs/04_releases.mkd @@ -6,6 +6,7 @@ #### fixes
+- Adjust repository search to handle foo.git and foo/bar.git (issue 104)
- Fixed bug where a repository set as authenticated push did not have anonymous clone access (issue 96)
- Fixed bug in Basic authentication if passwords had a colon (Github/peterloron)
- Fixed bug where the Gitblit Manager could not update a setting that was not referenced in reference.properties (issue 85)
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));
diff --git a/tests/com/gitblit/tests/JGitUtilsTest.java b/tests/com/gitblit/tests/JGitUtilsTest.java index dc4d3c50..316d1368 100644 --- a/tests/com/gitblit/tests/JGitUtilsTest.java +++ b/tests/com/gitblit/tests/JGitUtilsTest.java @@ -71,7 +71,7 @@ public class JGitUtilsTest { assertEquals(0, list.size());
list.addAll(JGitUtils.getRepositoryList(new File("DoesNotExist"), true, true));
assertEquals(0, list.size());
- list.addAll(JGitUtils.getRepositoryList(GitBlitSuite.REPOSITORIES, true, true));
+ list.addAll(JGitUtils.getRepositoryList(GitBlitSuite.REPOSITORIES, false, true));
assertTrue("No repositories found in " + GitBlitSuite.REPOSITORIES, list.size() > 0);
}
|