From 62ff847f820fc69c308aeff4b317963cd4eadce0 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Sat, 07 Mar 2015 12:26:23 -0500
Subject: [PATCH] Merged #233 "Ignore whitespace in diff viewer"
---
src/main/java/com/gitblit/utils/DiffUtils.java | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/main/java/com/gitblit/utils/DiffUtils.java b/src/main/java/com/gitblit/utils/DiffUtils.java
index 458a465..09b8f80 100644
--- a/src/main/java/com/gitblit/utils/DiffUtils.java
+++ b/src/main/java/com/gitblit/utils/DiffUtils.java
@@ -92,16 +92,24 @@
* Enumeration for the diff comparator types.
*/
public static enum DiffComparator {
- DEFAULT(RawTextComparator.DEFAULT),
- WS_IGNORE_ALL(RawTextComparator.WS_IGNORE_ALL),
- WS_IGNORE_LEADING(RawTextComparator.WS_IGNORE_LEADING),
- WS_IGNORE_TRAILING(RawTextComparator.WS_IGNORE_TRAILING),
- WS_IGNORE_CHANGE(RawTextComparator.WS_IGNORE_CHANGE);
+ SHOW_WHITESPACE(RawTextComparator.DEFAULT),
+ IGNORE_WHITESPACE(RawTextComparator.WS_IGNORE_ALL),
+ IGNORE_LEADING(RawTextComparator.WS_IGNORE_LEADING),
+ IGNORE_TRAILING(RawTextComparator.WS_IGNORE_TRAILING),
+ IGNORE_CHANGES(RawTextComparator.WS_IGNORE_CHANGE);
public final RawTextComparator textComparator;
DiffComparator(RawTextComparator textComparator) {
this.textComparator = textComparator;
+ }
+
+ public DiffComparator getOpposite() {
+ return this == SHOW_WHITESPACE ? IGNORE_WHITESPACE : SHOW_WHITESPACE;
+ }
+
+ public String getTranslationKey() {
+ return "gb." + name().toLowerCase();
}
public static DiffComparator forName(String name) {
@@ -371,7 +379,7 @@
break;
}
df.setRepository(repository);
- df.setDiffComparator((comparator == null ? DiffComparator.DEFAULT : comparator).textComparator);
+ df.setDiffComparator((comparator == null ? DiffComparator.SHOW_WHITESPACE : comparator).textComparator);
df.setDetectRenames(true);
RevTree commitTree = commit.getTree();
--
Gitblit v1.9.1