summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-10-16 13:14:30 -0400
committerJames Moger <james.moger@gitblit.com>2013-10-16 13:14:30 -0400
commit1feb04e5a907d06b2bf632395ba8d164931c0904 (patch)
treeab94e232b18b3a96593dca27a5d89ddab4da841d
parent9996f7217ea381d8e23755b3036f052cbdce6f3a (diff)
downloadgitblit-1feb04e5a907d06b2bf632395ba8d164931c0904.tar.gz
gitblit-1feb04e5a907d06b2bf632395ba8d164931c0904.zip
Fix Markdown document enumeraton
-rw-r--r--src/main/java/com/gitblit/utils/JGitUtils.java4
-rw-r--r--src/test/java/com/gitblit/tests/JGitUtilsTest.java7
2 files changed, 3 insertions, 8 deletions
diff --git a/src/main/java/com/gitblit/utils/JGitUtils.java b/src/main/java/com/gitblit/utils/JGitUtils.java
index ecc63592..be2860de 100644
--- a/src/main/java/com/gitblit/utils/JGitUtils.java
+++ b/src/main/java/com/gitblit/utils/JGitUtils.java
@@ -1049,10 +1049,10 @@ public class JGitUtils {
List<TreeFilter> suffixFilters = new ArrayList<TreeFilter>();
for (String extension : extensions) {
if (extension.charAt(0) == '.') {
- suffixFilters.add(PathSuffixFilter.create("\\" + extension));
+ suffixFilters.add(PathSuffixFilter.create(extension));
} else {
// escape the . since this is a regexp filter
- suffixFilters.add(PathSuffixFilter.create("\\." + extension));
+ suffixFilters.add(PathSuffixFilter.create("." + extension));
}
}
TreeFilter filter;
diff --git a/src/test/java/com/gitblit/tests/JGitUtilsTest.java b/src/test/java/com/gitblit/tests/JGitUtilsTest.java
index 9f7cb31e..a9374958 100644
--- a/src/test/java/com/gitblit/tests/JGitUtilsTest.java
+++ b/src/test/java/com/gitblit/tests/JGitUtilsTest.java
@@ -48,8 +48,6 @@ import org.eclipse.jgit.util.FileUtils;
import org.junit.Test;
import com.gitblit.Constants.SearchType;
-import com.gitblit.GitBlit;
-import com.gitblit.Keys;
import com.gitblit.models.GitNote;
import com.gitblit.models.PathModel;
import com.gitblit.models.PathModel.PathChangeModel;
@@ -484,14 +482,11 @@ public class JGitUtilsTest {
@Test
public void testDocuments() throws Exception {
Repository repository = GitBlitSuite.getTicgitRepository();
- List<String> extensions = GitBlit.getStrings(Keys.web.markdownExtensions);
+ List<String> extensions = Arrays.asList(new String[] { ".mkd", ".md" });
List<PathModel> markdownDocs = JGitUtils.getDocuments(repository, extensions);
- List<PathModel> markdownDocs2 = JGitUtils.getDocuments(repository,
- Arrays.asList(new String[] { ".mkd", ".md" }));
List<PathModel> allFiles = JGitUtils.getDocuments(repository, null);
repository.close();
assertTrue(markdownDocs.size() > 0);
- assertTrue(markdownDocs2.size() > 0);
assertTrue(allFiles.size() > markdownDocs.size());
}