TreeWalk treeWalk = new TreeWalk(repository);\r
treeWalk.addTree(branchHead.getTree());\r
treeWalk.setRecursive(true);\r
+ \r
\r
while (treeWalk.next()) {\r
result.blobCount++;\r
String blobPath = treeWalk.getPathString();\r
RevCommit blobRev = branchHead;\r
- \r
+ \r
RevWalk blobWalk = null;\r
if (fullIndex) {\r
// XXX this is _really_ slow, there must be a better way\r
PathFilterGroup.createFromStrings(Collections.singleton(blobPath)),\r
TreeFilter.ANY_DIFF);\r
blobWalk.setTreeFilter(filter);\r
-\r
- for (RevCommit commit : blobWalk) {\r
- blobRev = commit;\r
- break;\r
- }\r
+ blobRev = blobWalk.next();\r
}\r
\r
String blobAuthor = getAuthor(blobRev);\r
Resolution.MINUTE);\r
\r
if (blobWalk != null) {\r
- blobWalk.dispose();\r
+ blobWalk.dispose(); \r
}\r
\r
Document doc = new Document();\r
}\r
\r
public static Repository getGitectiveRepository() throws Exception {\r
- return new FileRepository(new File("test/gitective.git"));\r
+ return new FileRepository(new File(REPOSITORIES, "test/gitective.git"));\r
}\r
\r
public static boolean startGitblit() throws Exception {\r
public class LuceneUtilsTest {\r
\r
@Test\r
- public void testFullIndex() throws Exception {\r
+ public void testQuickIndex() throws Exception {\r
// reindex helloworld\r
Repository repository = GitBlitSuite.getHelloworldRepository();\r
String name = StringUtils.getRelativePath(GitBlitSuite.REPOSITORIES.getAbsolutePath(),\r
LuceneUtils.close();\r
}\r
\r
+ @Test\r
+ public void testFullIndex() throws Exception {\r
+ // reindex helloworld\r
+ Repository repository = GitBlitSuite.getHelloworldRepository();\r
+ String name = StringUtils.getRelativePath(GitBlitSuite.REPOSITORIES.getAbsolutePath(),\r
+ repository.getDirectory().getAbsolutePath());\r
+ LuceneUtils.reindex(name, repository, true);\r
+ SearchResult result = LuceneUtils.search("type:blob AND id:bit.bit", 1, repository).get(0); \r
+ repository.close();\r
+ assertEquals("Mike Donaghy", result.author);\r
+ //assertEquals("Mike Donaghy", result.date);\r
+ LuceneUtils.close();\r
+ }\r
+\r
@Test\r
public void testQuery() throws Exception {\r
// 2 occurrences on the master branch\r