From 85c2e6eb34215e2242e388a8f8b7173a14b96ad3 Mon Sep 17 00:00:00 2001 From: James Moger Date: Sat, 25 Jun 2011 08:57:29 -0400 Subject: Big push for first release. * Build script overhaul including building & publishing GO, WAR, Docs, and Site. * Restored JGit 0.12.1 dependency and backported Blame. Got tired of waiting for JGit 1.0.0 Maven artifacts. * Changed Summary Page layout * Optional cookie authentication * Added icons for log, tags, and branches panels. * Show last commit author and short message on branches panel. * Unit testing. * Documentation. --- src/com/gitblit/utils/JGitUtils.java | 15 ++++++++++++--- src/com/gitblit/utils/StringUtils.java | 7 ++++++- 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src/com/gitblit/utils') diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java index 5656efb3..1c607ca7 100644 --- a/src/com/gitblit/utils/JGitUtils.java +++ b/src/com/gitblit/utils/JGitUtils.java @@ -402,12 +402,12 @@ public class JGitUtils { public static List getFilesInCommit(Repository r, RevCommit commit) { List list = new ArrayList(); - RevWalk rw = new RevWalk(r); + RevWalk rw = new RevWalk(r); try { if (commit == null) { ObjectId object = r.resolve(Constants.HEAD); commit = rw.parseCommit(object); - } + } if (commit.getParentCount() == 0) { TreeWalk tw = new TreeWalk(r); @@ -441,7 +441,7 @@ public class JGitUtils { } catch (Throwable t) { LOGGER.error("failed to determine files in commit!", t); } finally { - rw.dispose(); + rw.dispose(); } return list; } @@ -526,6 +526,9 @@ public class JGitUtils { public static List getRevLog(Repository r, String objectId, String path, int offset, int maxCount) { List list = new ArrayList(); + if (maxCount == 0) { + return list; + } if (!hasCommits(r)) { return list; } @@ -591,6 +594,9 @@ public class JGitUtils { final SearchType type, int offset, int maxCount) { final String lcValue = value.toLowerCase(); List list = new ArrayList(); + if (maxCount == 0) { + return list; + } if (!hasCommits(r)) { return list; } @@ -677,6 +683,9 @@ public class JGitUtils { private static List getRefs(Repository r, String refs, boolean fullName, int maxCount) { List list = new ArrayList(); + if (maxCount == 0) { + return list; + } try { Map map = r.getRefDatabase().getRefs(refs); RevWalk rw = new RevWalk(r); diff --git a/src/com/gitblit/utils/StringUtils.java b/src/com/gitblit/utils/StringUtils.java index b53b5e15..219699fc 100644 --- a/src/com/gitblit/utils/StringUtils.java +++ b/src/com/gitblit/utils/StringUtils.java @@ -58,6 +58,11 @@ public class StringUtils { return retStr.toString(); } + public static String decodeFromHtml(String inStr) { + return inStr.replace("&", "&").replace("<", "<").replace(">", ">") + .replace(""", "\"").replace(" ", " "); + } + public static String encodeURL(String inStr) { StringBuffer retStr = new StringBuffer(); int i = 0; @@ -165,7 +170,7 @@ public class StringUtils { } return sb.toString(); } - + public static String getRootPath(String path) { if (path.indexOf('/') > -1) { return path.substring(0, path.lastIndexOf('/')); -- cgit v1.2.3