From 27ae9095639bb228a1b7ff86a3ebe4264abf05be Mon Sep 17 00:00:00 2001
From: mschaefers <mschaefers@scoop-gmbh.de>
Date: Thu, 29 Nov 2012 12:33:09 -0500
Subject: [PATCH] feature: when using LdapUserService one can configure Gitblit to fetch all users from ldap that can possibly login. This allows to see newly generated LDAP users instantly in Gitblit. By now an LDAP user had to log in once to appear in GitBlit.

---
 src/com/gitblit/models/PathModel.java |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/com/gitblit/models/PathModel.java b/src/com/gitblit/models/PathModel.java
index c78b300..8692359 100644
--- a/src/com/gitblit/models/PathModel.java
+++ b/src/com/gitblit/models/PathModel.java
@@ -35,17 +35,23 @@
 	public final String path;
 	public final long size;
 	public final int mode;
+	public final String objectId;
 	public final String commitId;
 	public boolean isParentPath;
 
-	public PathModel(String name, String path, long size, int mode, String commitId) {
+	public PathModel(String name, String path, long size, int mode, String objectId, String commitId) {
 		this.name = name;
 		this.path = path;
 		this.size = size;
 		this.mode = mode;
+		this.objectId = objectId;
 		this.commitId = commitId;
 	}
 
+	public boolean isSubmodule() {
+		return FileMode.GITLINK.equals(mode);
+	}
+	
 	public boolean isTree() {
 		return FileMode.TREE.equals(mode);
 	}
@@ -71,6 +77,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;
@@ -91,9 +104,9 @@
 
 		public final ChangeType changeType;
 
-		public PathChangeModel(String name, String path, long size, int mode, String commitId,
-				ChangeType type) {
-			super(name, path, size, mode, commitId);
+		public PathChangeModel(String name, String path, long size, int mode, String objectId,
+				String commitId, ChangeType type) {
+			super(name, path, size, mode, objectId, commitId);
 			this.changeType = type;
 		}
 

--
Gitblit v1.9.1