From 856091d000befd51967f20e1a7e59ccc59663f99 Mon Sep 17 00:00:00 2001 From: James Moger Date: Tue, 20 Mar 2012 19:39:20 -0400 Subject: [PATCH] Properly handle renames on incremental indexing --- src/com/gitblit/LuceneExecutor.java | 2 +- src/com/gitblit/utils/JGitUtils.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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 -- 2.39.5