From 73f1adb2e84b8b9cd4045bcdd7d9afa72d3875b5 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Tue, 27 Nov 2012 17:13:03 -0500 Subject: [PATCH] Added short commit id column to log and history tables (issue 168) --- src/com/gitblit/utils/GitBlitDiffFormatter.java | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/com/gitblit/utils/GitBlitDiffFormatter.java b/src/com/gitblit/utils/GitBlitDiffFormatter.java index e9fbf52..2966aa8 100644 --- a/src/com/gitblit/utils/GitBlitDiffFormatter.java +++ b/src/com/gitblit/utils/GitBlitDiffFormatter.java @@ -127,15 +127,24 @@ } else if (line.startsWith("---") || line.startsWith("+++")) { // skip --- +++ lines } else if (line.startsWith("diff")) { + line = StringUtils.convertOctal(line); if (line.indexOf(oldnull) > -1) { // a is null, use b line = line.substring(("diff --git " + oldnull).length()).trim(); // trim b/ - line = line.substring(2); + line = line.substring(2).trim(); } else { // use a - line = line.substring("diff --git a/".length()).trim(); - line = line.substring(0, line.indexOf(" b/")).trim(); + line = line.substring("diff --git ".length()).trim(); + line = line.substring(line.startsWith("\"a/") ? 3 : 2); + line = line.substring(0, line.indexOf(" b/") > -1 ? line.indexOf(" b/") : line.indexOf("\"b/")).trim(); + } + + if (line.charAt(0) == '"') { + line = line.substring(1); + } + if (line.charAt(line.length() - 1) == '"') { + line = line.substring(0, line.length() - 1); } if (inFile) { sb.append("</tbody></table></div>\n"); -- Gitblit v1.9.1