]> source.dussan.org Git - gitblit.git/commitdiff
Improve submodule checking in LuceneExecutor (issue-119)
authorJames Moger <james.moger@gitblit.com>
Fri, 10 Aug 2012 21:37:36 +0000 (17:37 -0400)
committerJames Moger <james.moger@gitblit.com>
Fri, 10 Aug 2012 21:37:36 +0000 (17:37 -0400)
src/com/gitblit/LuceneExecutor.java
src/com/gitblit/models/PathModel.java

index d1c27f4d41350b28ff627ac1b558b2ee30b1aa38..9cae3d52c83d23420b808ca878e9f93d1e036ada 100644 (file)
@@ -652,6 +652,9 @@ public class LuceneExecutor implements Runnable {
                                        Resolution.MINUTE);\r
                        IndexWriter writer = getIndexWriter(repositoryName);\r
                        for (PathChangeModel path : changedPaths) {\r
+                               if (path.isSubmodule()) {\r
+                                       continue;\r
+                               }\r
                                // delete the indexed blob\r
                                deleteBlob(repositoryName, branch, path.name);\r
 \r
index c78b300c08f04bc75587efb04b605d53cfd6e2d3..9bb7eb736af7a4d766fc75c451a97b465e264e42 100644 (file)
@@ -46,6 +46,10 @@ public class PathModel implements Serializable, Comparable<PathModel> {
                this.commitId = commitId;\r
        }\r
 \r
+       public boolean isSubmodule() {\r
+               return FileMode.GITLINK.equals(mode);\r
+       }\r
+       \r
        public boolean isTree() {\r
                return FileMode.TREE.equals(mode);\r
        }\r
@@ -71,6 +75,13 @@ public class PathModel implements Serializable, Comparable<PathModel> {
                if (isTree && otherTree) {\r
                        return path.compareTo(o.path);\r
                } else if (!isTree && !otherTree) {\r
+                       if (isSubmodule() && o.isSubmodule()) {\r
+                               return path.compareTo(o.path);\r
+                       } else if (isSubmodule()) {\r
+                               return -1;\r
+                       } else if (o.isSubmodule()) {\r
+                               return 1;\r
+                       }\r
                        return path.compareTo(o.path);\r
                } else if (isTree && !otherTree) {\r
                        return -1;\r