From: James Moger Date: Tue, 20 Mar 2012 23:39:20 +0000 (-0400) Subject: Properly handle renames on incremental indexing X-Git-Tag: v0.9.0~41 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=856091d000befd51967f20e1a7e59ccc59663f99;p=gitblit.git Properly handle renames on incremental indexing --- diff --git a/src/com/gitblit/LuceneExecutor.java b/src/com/gitblit/LuceneExecutor.java index 29a8569d..a425cc3d 100644 --- a/src/com/gitblit/LuceneExecutor.java +++ b/src/com/gitblit/LuceneExecutor.java @@ -622,7 +622,7 @@ public class LuceneExecutor implements Runnable { IndexWriter writer = getIndexWriter(repositoryName); for (PathChangeModel path : changedPaths) { // delete the indexed blob - deleteBlob(repositoryName, branch, path.path); + deleteBlob(repositoryName, branch, path.name); // re-index the blob if (!ChangeType.DELETE.equals(path.changeType)) { diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java index c39ab715..99b2f738 100644 --- a/src/com/gitblit/utils/JGitUtils.java +++ b/src/com/gitblit/utils/JGitUtils.java @@ -721,6 +721,10 @@ public class JGitUtils { list.add(new PathChangeModel(diff.getOldPath(), diff.getOldPath(), 0, diff .getNewMode().getBits(), commit.getId().getName(), diff .getChangeType())); + } else if (diff.getChangeType().equals(ChangeType.RENAME)) { + list.add(new PathChangeModel(diff.getOldPath(), diff.getNewPath(), 0, diff + .getNewMode().getBits(), commit.getId().getName(), diff + .getChangeType())); } else { list.add(new PathChangeModel(diff.getNewPath(), diff.getNewPath(), 0, diff .getNewMode().getBits(), commit.getId().getName(), diff