James Moger
2011-04-16 01bd346efe98af0f05f23f897c0819d2df8d856c
src/com/gitblit/wicket/models/PathModel.java
@@ -4,18 +4,17 @@
import com.gitblit.utils.JGitUtils;
public class PathModel implements Serializable, Comparable<PathModel> {
   private static final long serialVersionUID = 1L;
   public final String name;
   public final String path;
   public final long size;
   public final int  mode;
   public final int mode;
   public final String commitId;
   public boolean isParentPath;
   public PathModel(String name, String path, long size, int mode, String commitId) {
      this.name = name;
      this.path = path;
@@ -23,11 +22,11 @@
      this.mode = mode;
      this.commitId = commitId;
   }
   public boolean isTree() {
      return JGitUtils.isTreeFromMode(mode);
   }
   public static PathModel getParentPath(String basePath, String commitId) {
      String parentPath = null;
      if (basePath.lastIndexOf('/') > -1) {
@@ -40,6 +39,15 @@
   @Override
   public int compareTo(PathModel o) {
      return path.compareTo(o.path);
      boolean isTree = isTree();
      boolean otherTree = o.isTree();
      if (isTree && otherTree) {
         return path.compareTo(o.path);
      } else if (!isTree && !otherTree) {
         return path.compareTo(o.path);
      } else if (isTree && !otherTree) {
         return -1;
      }
      return 1;
   }
}