From 9802a766a28bfcb0ae01494ebfa1cbeb11e71809 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Sun, 17 Apr 2011 12:06:29 -0400
Subject: [PATCH] Rename ticgit integration to tickets.

---
 src/com/gitblit/wicket/models/PathModel.java |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/com/gitblit/wicket/models/PathModel.java b/src/com/gitblit/wicket/models/PathModel.java
index 3fa0f63..e2e463f 100644
--- a/src/com/gitblit/wicket/models/PathModel.java
+++ b/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;
 	}
 }

--
Gitblit v1.9.1