From 699e71e76b15081baf746c6ce9c9144f7e5f1ff9 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Mon, 30 Sep 2013 10:11:28 -0400
Subject: [PATCH] Trim trailing whitespace and organize imports
---
src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java b/src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java
index 8ca4285..47ff143 100644
--- a/src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java
+++ b/src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java
@@ -34,9 +34,9 @@
/**
* Generates an html snippet of a diff in Gitblit's style, tracks changed paths,
* and calculates diff stats.
- *
+ *
* @author James Moger
- *
+ *
*/
public class GitBlitDiffFormatter extends DiffFormatter {
@@ -47,22 +47,22 @@
private PathChangeModel currentPath;
private int left, right;
-
+
public GitBlitDiffFormatter(OutputStream os, String commitId) {
super(os);
this.os = os;
this.diffStat = new DiffStat(commitId);
}
-
+
@Override
public void format(DiffEntry ent) throws IOException {
currentPath = diffStat.addPath(ent);
super.format(ent);
}
-
+
/**
* Output a hunk header
- *
+ *
* @param aStartLine
* within first source
* @param aEndLine
@@ -88,7 +88,7 @@
left = aStartLine + 1;
right = bStartLine + 1;
}
-
+
protected void writeRange(final char prefix, final int begin, final int cnt) throws IOException {
os.write(' ');
os.write(prefix);
@@ -127,7 +127,7 @@
throws IOException {
// update entry diffstat
currentPath.update(prefix);
-
+
// output diff
os.write("<tr>".getBytes());
switch (prefix) {
@@ -162,7 +162,7 @@
/**
* Workaround function for complex private methods in DiffFormatter. This
* sets the html for the diff headers.
- *
+ *
* @return
*/
public String getHtml() {
@@ -191,10 +191,10 @@
} else {
// use a
line = line.substring("diff --git ".length()).trim();
- line = line.substring(line.startsWith("\"a/") ? 3 : 2);
+ 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);
}
@@ -205,7 +205,7 @@
sb.append("</tbody></table></div>\n");
inFile = false;
}
-
+
sb.append(MessageFormat.format("<div class='header'><div class=\"diffHeader\" id=\"{0}\"><i class=\"icon-file\"></i> ", line)).append(line).append("</div></div>");
sb.append("<div class=\"diff\">");
sb.append("<table><tbody>");
@@ -229,7 +229,7 @@
sb.append("</table></div>");
return sb.toString();
}
-
+
public DiffStat getDiffStat() {
return diffStat;
}
--
Gitblit v1.9.1