James Moger
2012-08-10 88fb67f6cfdef7a3d44691aca623d3486fec3655
Improve submodule checking in LuceneExecutor (issue-119)
2 files modified
14 ■■■■■ changed files
src/com/gitblit/LuceneExecutor.java 3 ●●●●● patch | view | raw | blame | history
src/com/gitblit/models/PathModel.java 11 ●●●●● patch | view | raw | blame | history
src/com/gitblit/LuceneExecutor.java
@@ -652,6 +652,9 @@
                    Resolution.MINUTE);
            IndexWriter writer = getIndexWriter(repositoryName);
            for (PathChangeModel path : changedPaths) {
                if (path.isSubmodule()) {
                    continue;
                }
                // delete the indexed blob
                deleteBlob(repositoryName, branch, path.name);
src/com/gitblit/models/PathModel.java
@@ -46,6 +46,10 @@
        this.commitId = commitId;
    }
    public boolean isSubmodule() {
        return FileMode.GITLINK.equals(mode);
    }
    public boolean isTree() {
        return FileMode.TREE.equals(mode);
    }
@@ -71,6 +75,13 @@
        if (isTree && otherTree) {
            return path.compareTo(o.path);
        } else if (!isTree && !otherTree) {
            if (isSubmodule() && o.isSubmodule()) {
                return path.compareTo(o.path);
            } else if (isSubmodule()) {
                return -1;
            } else if (o.isSubmodule()) {
                return 1;
            }
            return path.compareTo(o.path);
        } else if (isTree && !otherTree) {
            return -1;