diff --git a/java-diff-utils-jgit/nb-configuration.xml b/java-diff-utils-jgit/nb-configuration.xml
new file mode 100644
index 0000000..ca588fa
--- /dev/null
+++ b/java-diff-utils-jgit/nb-configuration.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+ none
+ JDK_1.8
+
+
diff --git a/java-diff-utils-jgit/pom.xml b/java-diff-utils-jgit/pom.xml
new file mode 100644
index 0000000..6a7f281
--- /dev/null
+++ b/java-diff-utils-jgit/pom.xml
@@ -0,0 +1,58 @@
+
+
+ 4.0.0
+
+ io.github.java-diff-utils
+ java-diff-utils-parent
+ 4.1-SNAPSHOT
+
+ java-diff-utils-jgit
+ jar
+ This is an extension of java-diff-utils using jgit to use its implementation of
+some difference algorithms.
+
+
+ junit
+ junit
+ 4.12
+ jar
+ test
+
+
+ org.eclipse.jgit
+ org.eclipse.jgit
+ 4.4.1.201607150455-r
+
+
+ com.googlecode.javaewah
+ JavaEWAH
+
+
+ commons-codec
+ commons-codec
+
+
+ commons-logging
+ commons-logging
+
+
+ org.apache.httpcomponents
+ httpclient
+
+
+ com.jcraft
+ jsch
+
+
+ org.slf4j
+ slf4j-api
+
+
+
+
+ ${project.groupId}
+ java-diff-utils
+ ${project.version}
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/github/difflib/algorithm/jgit/HistogramDiff.java b/java-diff-utils-jgit/src/main/java/com/github/difflib/algorithm/jgit/HistogramDiff.java
similarity index 100%
rename from src/main/java/com/github/difflib/algorithm/jgit/HistogramDiff.java
rename to java-diff-utils-jgit/src/main/java/com/github/difflib/algorithm/jgit/HistogramDiff.java
diff --git a/src/test/java/com/github/difflib/algorithm/jgit/HistogramDiffTest.java b/java-diff-utils-jgit/src/test/java/com/github/difflib/algorithm/jgit/HistogramDiffTest.java
similarity index 100%
rename from src/test/java/com/github/difflib/algorithm/jgit/HistogramDiffTest.java
rename to java-diff-utils-jgit/src/test/java/com/github/difflib/algorithm/jgit/HistogramDiffTest.java
diff --git a/src/test/java/com/github/difflib/algorithm/jgit/LRHistogramDiffTest.java b/java-diff-utils-jgit/src/test/java/com/github/difflib/algorithm/jgit/LRHistogramDiffTest.java
similarity index 80%
rename from src/test/java/com/github/difflib/algorithm/jgit/LRHistogramDiffTest.java
rename to java-diff-utils-jgit/src/test/java/com/github/difflib/algorithm/jgit/LRHistogramDiffTest.java
index cf68cb3..02dfe85 100644
--- a/src/test/java/com/github/difflib/algorithm/jgit/LRHistogramDiffTest.java
+++ b/java-diff-utils-jgit/src/test/java/com/github/difflib/algorithm/jgit/LRHistogramDiffTest.java
@@ -15,14 +15,18 @@
*/
package com.github.difflib.algorithm.jgit;
-import static com.github.difflib.DiffUtilsTest.readStringListFromInputStream;
-import com.github.difflib.TestConstants;
import com.github.difflib.algorithm.DiffAlgorithmListener;
import com.github.difflib.patch.Patch;
import com.github.difflib.patch.PatchFailedException;
+import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
+import static java.util.stream.Collectors.toList;
import java.util.zip.ZipFile;
import org.junit.After;
import org.junit.AfterClass;
@@ -58,7 +62,7 @@ public class LRHistogramDiffTest {
@Test
public void testPossibleDiffHangOnLargeDatasetDnaumenkoIssue26() throws IOException, PatchFailedException {
- ZipFile zip = new ZipFile(TestConstants.MOCK_FOLDER + "/large_dataset1.zip");
+ ZipFile zip = new ZipFile("target/test-classes/mocks/large_dataset1.zip");
List original = readStringListFromInputStream(zip.getInputStream(zip.getEntry("ta")));
List revised = readStringListFromInputStream(zip.getInputStream(zip.getEntry("tb")));
@@ -88,4 +92,11 @@ public class LRHistogramDiffTest {
assertEquals(246579, logdata.size());
}
+ public static List readStringListFromInputStream(InputStream is) throws IOException {
+ try (BufferedReader reader = new BufferedReader(
+ new InputStreamReader(is, Charset.forName(StandardCharsets.UTF_8.name())))) {
+
+ return reader.lines().collect(toList());
+ }
+ }
}
diff --git a/src/test/resources/mocks/large_dataset1.zip b/java-diff-utils-jgit/src/test/resources/mocks/large_dataset1.zip
similarity index 100%
rename from src/test/resources/mocks/large_dataset1.zip
rename to java-diff-utils-jgit/src/test/resources/mocks/large_dataset1.zip
diff --git a/java-diff-utils/pom.xml b/java-diff-utils/pom.xml
new file mode 100644
index 0000000..7ffe5d3
--- /dev/null
+++ b/java-diff-utils/pom.xml
@@ -0,0 +1,60 @@
+
+ 4.0.0
+ io.github.java-diff-utils
+ java-diff-utils
+ jar
+ java-diff-utils
+
+ io.github.java-diff-utils
+ java-diff-utils-parent
+ 4.1-SNAPSHOT
+
+
+ UTF-8
+
+
+
+
+ junit
+ junit
+ 4.12
+ jar
+ test
+
+
+ org.assertj
+ assertj-core
+ 3.11.1
+ test
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.6.1
+
+ 1.8
+ 1.8
+ UTF-8
+
+
+
+ maven-jar-plugin
+ 3.0.2
+
+
+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF
+
+
+ io.github.java-diff-utils
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/github/difflib/DiffUtils.java b/java-diff-utils/src/main/java/com/github/difflib/DiffUtils.java
similarity index 100%
rename from src/main/java/com/github/difflib/DiffUtils.java
rename to java-diff-utils/src/main/java/com/github/difflib/DiffUtils.java
diff --git a/src/main/java/com/github/difflib/UnifiedDiffUtils.java b/java-diff-utils/src/main/java/com/github/difflib/UnifiedDiffUtils.java
similarity index 100%
rename from src/main/java/com/github/difflib/UnifiedDiffUtils.java
rename to java-diff-utils/src/main/java/com/github/difflib/UnifiedDiffUtils.java
diff --git a/src/main/java/com/github/difflib/algorithm/Change.java b/java-diff-utils/src/main/java/com/github/difflib/algorithm/Change.java
similarity index 100%
rename from src/main/java/com/github/difflib/algorithm/Change.java
rename to java-diff-utils/src/main/java/com/github/difflib/algorithm/Change.java
diff --git a/src/main/java/com/github/difflib/algorithm/DiffAlgorithmI.java b/java-diff-utils/src/main/java/com/github/difflib/algorithm/DiffAlgorithmI.java
similarity index 100%
rename from src/main/java/com/github/difflib/algorithm/DiffAlgorithmI.java
rename to java-diff-utils/src/main/java/com/github/difflib/algorithm/DiffAlgorithmI.java
diff --git a/src/main/java/com/github/difflib/algorithm/DiffAlgorithmListener.java b/java-diff-utils/src/main/java/com/github/difflib/algorithm/DiffAlgorithmListener.java
similarity index 100%
rename from src/main/java/com/github/difflib/algorithm/DiffAlgorithmListener.java
rename to java-diff-utils/src/main/java/com/github/difflib/algorithm/DiffAlgorithmListener.java
diff --git a/src/main/java/com/github/difflib/algorithm/DiffException.java b/java-diff-utils/src/main/java/com/github/difflib/algorithm/DiffException.java
similarity index 100%
rename from src/main/java/com/github/difflib/algorithm/DiffException.java
rename to java-diff-utils/src/main/java/com/github/difflib/algorithm/DiffException.java
diff --git a/src/main/java/com/github/difflib/algorithm/DifferentiationFailedException.java b/java-diff-utils/src/main/java/com/github/difflib/algorithm/DifferentiationFailedException.java
similarity index 100%
rename from src/main/java/com/github/difflib/algorithm/DifferentiationFailedException.java
rename to java-diff-utils/src/main/java/com/github/difflib/algorithm/DifferentiationFailedException.java
diff --git a/src/main/java/com/github/difflib/algorithm/myers/MyersDiff.java b/java-diff-utils/src/main/java/com/github/difflib/algorithm/myers/MyersDiff.java
similarity index 100%
rename from src/main/java/com/github/difflib/algorithm/myers/MyersDiff.java
rename to java-diff-utils/src/main/java/com/github/difflib/algorithm/myers/MyersDiff.java
diff --git a/src/main/java/com/github/difflib/algorithm/myers/PathNode.java b/java-diff-utils/src/main/java/com/github/difflib/algorithm/myers/PathNode.java
similarity index 100%
rename from src/main/java/com/github/difflib/algorithm/myers/PathNode.java
rename to java-diff-utils/src/main/java/com/github/difflib/algorithm/myers/PathNode.java
diff --git a/src/main/java/com/github/difflib/patch/AbstractDelta.java b/java-diff-utils/src/main/java/com/github/difflib/patch/AbstractDelta.java
similarity index 100%
rename from src/main/java/com/github/difflib/patch/AbstractDelta.java
rename to java-diff-utils/src/main/java/com/github/difflib/patch/AbstractDelta.java
diff --git a/src/main/java/com/github/difflib/patch/ChangeDelta.java b/java-diff-utils/src/main/java/com/github/difflib/patch/ChangeDelta.java
similarity index 100%
rename from src/main/java/com/github/difflib/patch/ChangeDelta.java
rename to java-diff-utils/src/main/java/com/github/difflib/patch/ChangeDelta.java
diff --git a/src/main/java/com/github/difflib/patch/Chunk.java b/java-diff-utils/src/main/java/com/github/difflib/patch/Chunk.java
similarity index 100%
rename from src/main/java/com/github/difflib/patch/Chunk.java
rename to java-diff-utils/src/main/java/com/github/difflib/patch/Chunk.java
diff --git a/src/main/java/com/github/difflib/patch/DeleteDelta.java b/java-diff-utils/src/main/java/com/github/difflib/patch/DeleteDelta.java
similarity index 100%
rename from src/main/java/com/github/difflib/patch/DeleteDelta.java
rename to java-diff-utils/src/main/java/com/github/difflib/patch/DeleteDelta.java
diff --git a/src/main/java/com/github/difflib/patch/DeltaType.java b/java-diff-utils/src/main/java/com/github/difflib/patch/DeltaType.java
similarity index 100%
rename from src/main/java/com/github/difflib/patch/DeltaType.java
rename to java-diff-utils/src/main/java/com/github/difflib/patch/DeltaType.java
diff --git a/src/main/java/com/github/difflib/patch/DiffException.java b/java-diff-utils/src/main/java/com/github/difflib/patch/DiffException.java
similarity index 100%
rename from src/main/java/com/github/difflib/patch/DiffException.java
rename to java-diff-utils/src/main/java/com/github/difflib/patch/DiffException.java
diff --git a/src/main/java/com/github/difflib/patch/InsertDelta.java b/java-diff-utils/src/main/java/com/github/difflib/patch/InsertDelta.java
similarity index 100%
rename from src/main/java/com/github/difflib/patch/InsertDelta.java
rename to java-diff-utils/src/main/java/com/github/difflib/patch/InsertDelta.java
diff --git a/src/main/java/com/github/difflib/patch/Patch.java b/java-diff-utils/src/main/java/com/github/difflib/patch/Patch.java
similarity index 100%
rename from src/main/java/com/github/difflib/patch/Patch.java
rename to java-diff-utils/src/main/java/com/github/difflib/patch/Patch.java
diff --git a/src/main/java/com/github/difflib/patch/PatchFailedException.java b/java-diff-utils/src/main/java/com/github/difflib/patch/PatchFailedException.java
similarity index 100%
rename from src/main/java/com/github/difflib/patch/PatchFailedException.java
rename to java-diff-utils/src/main/java/com/github/difflib/patch/PatchFailedException.java
diff --git a/src/main/java/com/github/difflib/text/DiffRow.java b/java-diff-utils/src/main/java/com/github/difflib/text/DiffRow.java
similarity index 100%
rename from src/main/java/com/github/difflib/text/DiffRow.java
rename to java-diff-utils/src/main/java/com/github/difflib/text/DiffRow.java
diff --git a/src/main/java/com/github/difflib/text/DiffRowGenerator.java b/java-diff-utils/src/main/java/com/github/difflib/text/DiffRowGenerator.java
similarity index 100%
rename from src/main/java/com/github/difflib/text/DiffRowGenerator.java
rename to java-diff-utils/src/main/java/com/github/difflib/text/DiffRowGenerator.java
diff --git a/src/main/java/com/github/difflib/text/StringUtils.java b/java-diff-utils/src/main/java/com/github/difflib/text/StringUtils.java
similarity index 100%
rename from src/main/java/com/github/difflib/text/StringUtils.java
rename to java-diff-utils/src/main/java/com/github/difflib/text/StringUtils.java
diff --git a/src/main/java/com/github/difflib/unifieddiff/UnifiedDiff.java b/java-diff-utils/src/main/java/com/github/difflib/unifieddiff/UnifiedDiff.java
similarity index 100%
rename from src/main/java/com/github/difflib/unifieddiff/UnifiedDiff.java
rename to java-diff-utils/src/main/java/com/github/difflib/unifieddiff/UnifiedDiff.java
diff --git a/src/main/java/com/github/difflib/unifieddiff/UnifiedDiffFile.java b/java-diff-utils/src/main/java/com/github/difflib/unifieddiff/UnifiedDiffFile.java
similarity index 100%
rename from src/main/java/com/github/difflib/unifieddiff/UnifiedDiffFile.java
rename to java-diff-utils/src/main/java/com/github/difflib/unifieddiff/UnifiedDiffFile.java
diff --git a/src/main/java/com/github/difflib/unifieddiff/UnifiedDiffParserException.java b/java-diff-utils/src/main/java/com/github/difflib/unifieddiff/UnifiedDiffParserException.java
similarity index 100%
rename from src/main/java/com/github/difflib/unifieddiff/UnifiedDiffParserException.java
rename to java-diff-utils/src/main/java/com/github/difflib/unifieddiff/UnifiedDiffParserException.java
diff --git a/src/main/java/com/github/difflib/unifieddiff/UnifiedDiffReader.java b/java-diff-utils/src/main/java/com/github/difflib/unifieddiff/UnifiedDiffReader.java
similarity index 100%
rename from src/main/java/com/github/difflib/unifieddiff/UnifiedDiffReader.java
rename to java-diff-utils/src/main/java/com/github/difflib/unifieddiff/UnifiedDiffReader.java
diff --git a/src/main/java/com/github/difflib/unifieddiff/UnifiedDiffWriter.java b/java-diff-utils/src/main/java/com/github/difflib/unifieddiff/UnifiedDiffWriter.java
similarity index 100%
rename from src/main/java/com/github/difflib/unifieddiff/UnifiedDiffWriter.java
rename to java-diff-utils/src/main/java/com/github/difflib/unifieddiff/UnifiedDiffWriter.java
diff --git a/src/main/java/com/github/difflib/unifieddiff/package-info.java b/java-diff-utils/src/main/java/com/github/difflib/unifieddiff/package-info.java
similarity index 100%
rename from src/main/java/com/github/difflib/unifieddiff/package-info.java
rename to java-diff-utils/src/main/java/com/github/difflib/unifieddiff/package-info.java
diff --git a/src/test/java/com/github/difflib/DiffUtilsTest.java b/java-diff-utils/src/test/java/com/github/difflib/DiffUtilsTest.java
similarity index 100%
rename from src/test/java/com/github/difflib/DiffUtilsTest.java
rename to java-diff-utils/src/test/java/com/github/difflib/DiffUtilsTest.java
diff --git a/src/test/java/com/github/difflib/GenerateUnifiedDiffTest.java b/java-diff-utils/src/test/java/com/github/difflib/GenerateUnifiedDiffTest.java
similarity index 100%
rename from src/test/java/com/github/difflib/GenerateUnifiedDiffTest.java
rename to java-diff-utils/src/test/java/com/github/difflib/GenerateUnifiedDiffTest.java
diff --git a/src/test/java/com/github/difflib/TestConstants.java b/java-diff-utils/src/test/java/com/github/difflib/TestConstants.java
similarity index 100%
rename from src/test/java/com/github/difflib/TestConstants.java
rename to java-diff-utils/src/test/java/com/github/difflib/TestConstants.java
diff --git a/src/test/java/com/github/difflib/algorithm/myers/MyersDiffTest.java b/java-diff-utils/src/test/java/com/github/difflib/algorithm/myers/MyersDiffTest.java
similarity index 100%
rename from src/test/java/com/github/difflib/algorithm/myers/MyersDiffTest.java
rename to java-diff-utils/src/test/java/com/github/difflib/algorithm/myers/MyersDiffTest.java
diff --git a/src/test/java/com/github/difflib/examples/ApplyPatch.java b/java-diff-utils/src/test/java/com/github/difflib/examples/ApplyPatch.java
similarity index 100%
rename from src/test/java/com/github/difflib/examples/ApplyPatch.java
rename to java-diff-utils/src/test/java/com/github/difflib/examples/ApplyPatch.java
diff --git a/src/test/java/com/github/difflib/examples/ComputeDifference.java b/java-diff-utils/src/test/java/com/github/difflib/examples/ComputeDifference.java
similarity index 100%
rename from src/test/java/com/github/difflib/examples/ComputeDifference.java
rename to java-diff-utils/src/test/java/com/github/difflib/examples/ComputeDifference.java
diff --git a/src/test/java/com/github/difflib/patch/PatchTest.java b/java-diff-utils/src/test/java/com/github/difflib/patch/PatchTest.java
similarity index 100%
rename from src/test/java/com/github/difflib/patch/PatchTest.java
rename to java-diff-utils/src/test/java/com/github/difflib/patch/PatchTest.java
diff --git a/src/test/java/com/github/difflib/text/DiffRowGeneratorTest.java b/java-diff-utils/src/test/java/com/github/difflib/text/DiffRowGeneratorTest.java
similarity index 100%
rename from src/test/java/com/github/difflib/text/DiffRowGeneratorTest.java
rename to java-diff-utils/src/test/java/com/github/difflib/text/DiffRowGeneratorTest.java
diff --git a/src/test/java/com/github/difflib/text/StringUtilsTest.java b/java-diff-utils/src/test/java/com/github/difflib/text/StringUtilsTest.java
similarity index 100%
rename from src/test/java/com/github/difflib/text/StringUtilsTest.java
rename to java-diff-utils/src/test/java/com/github/difflib/text/StringUtilsTest.java
diff --git a/src/test/java/com/github/difflib/unifieddiff/UnifiedDiffReaderTest.java b/java-diff-utils/src/test/java/com/github/difflib/unifieddiff/UnifiedDiffReaderTest.java
similarity index 100%
rename from src/test/java/com/github/difflib/unifieddiff/UnifiedDiffReaderTest.java
rename to java-diff-utils/src/test/java/com/github/difflib/unifieddiff/UnifiedDiffReaderTest.java
diff --git a/src/test/java/com/github/difflib/unifieddiff/UnifiedDiffRoundTripTest.java b/java-diff-utils/src/test/java/com/github/difflib/unifieddiff/UnifiedDiffRoundTripTest.java
similarity index 100%
rename from src/test/java/com/github/difflib/unifieddiff/UnifiedDiffRoundTripTest.java
rename to java-diff-utils/src/test/java/com/github/difflib/unifieddiff/UnifiedDiffRoundTripTest.java
diff --git a/src/test/java/com/github/difflib/unifieddiff/UnifiedDiffWriterTest.java b/java-diff-utils/src/test/java/com/github/difflib/unifieddiff/UnifiedDiffWriterTest.java
similarity index 100%
rename from src/test/java/com/github/difflib/unifieddiff/UnifiedDiffWriterTest.java
rename to java-diff-utils/src/test/java/com/github/difflib/unifieddiff/UnifiedDiffWriterTest.java
diff --git a/src/test/resources/com/github/difflib/unifieddiff/jsqlparser_patch_1.diff b/java-diff-utils/src/test/resources/com/github/difflib/unifieddiff/jsqlparser_patch_1.diff
similarity index 100%
rename from src/test/resources/com/github/difflib/unifieddiff/jsqlparser_patch_1.diff
rename to java-diff-utils/src/test/resources/com/github/difflib/unifieddiff/jsqlparser_patch_1.diff
diff --git a/src/test/resources/com/github/difflib/unifieddiff/problem_diff_issue33.diff b/java-diff-utils/src/test/resources/com/github/difflib/unifieddiff/problem_diff_issue33.diff
similarity index 100%
rename from src/test/resources/com/github/difflib/unifieddiff/problem_diff_issue33.diff
rename to java-diff-utils/src/test/resources/com/github/difflib/unifieddiff/problem_diff_issue33.diff
diff --git a/src/test/resources/com/github/difflib/unifieddiff/problem_diff_issue46.diff b/java-diff-utils/src/test/resources/com/github/difflib/unifieddiff/problem_diff_issue46.diff
similarity index 100%
rename from src/test/resources/com/github/difflib/unifieddiff/problem_diff_issue46.diff
rename to java-diff-utils/src/test/resources/com/github/difflib/unifieddiff/problem_diff_issue46.diff
diff --git a/src/test/resources/mocks/5A.txt b/java-diff-utils/src/test/resources/mocks/5A.txt
similarity index 96%
rename from src/test/resources/mocks/5A.txt
rename to java-diff-utils/src/test/resources/mocks/5A.txt
index 96e51b8..69eafd8 100644
--- a/src/test/resources/mocks/5A.txt
+++ b/java-diff-utils/src/test/resources/mocks/5A.txt
@@ -1,372 +1,372 @@
-#!/bin/sh
-#
-# Copyright (c) 2006 Johannes E. Schindelin
-#
-
-test_description='Test special whitespace in diff engine.
-
-'
-. ./test-lib.sh
-. ../diff-lib.sh
-
-# Ray Lehtiniemi's example
-
-cat << EOF > x
-do {
- nothing;
-} while (0);
-EOF
-
-git update-index --add x
-
-cat << EOF > x
-do
-{
- nothing;
-}
-while (0);
-EOF
-
-cat << EOF > expect
-diff --git a/x b/x
-index adf3937..6edc172 100644
---- a/x
-+++ b/x
-@@ -1,3 +1,5 @@
--do {
-+do
-+{
- nothing;
--} while (0);
-+}
-+while (0);
-EOF
-
-git diff > out
-test_expect_success "Ray's example without options" 'test_cmp expect out'
-
-git diff -w > out
-test_expect_success "Ray's example with -w" 'test_cmp expect out'
-
-git diff -b > out
-test_expect_success "Ray's example with -b" 'test_cmp expect out'
-
-tr 'Q' '\015' << EOF > x
-whitespace at beginning
-whitespace change
-whitespace in the middle
-whitespace at end
-unchanged line
-CR at endQ
-EOF
-
-git update-index x
-
-tr '_' ' ' << EOF > x
- whitespace at beginning
-whitespace change
-white space in the middle
-whitespace at end__
-unchanged line
-CR at end
-EOF
-
-tr 'Q_' '\015 ' << EOF > expect
-diff --git a/x b/x
-index d99af23..8b32fb5 100644
---- a/x
-+++ b/x
-@@ -1,6 +1,6 @@
--whitespace at beginning
--whitespace change
--whitespace in the middle
--whitespace at end
-+ whitespace at beginning
-+whitespace change
-+white space in the middle
-+whitespace at end__
-unchanged line
--CR at endQ
-+CR at end
-EOF
-git diff > out
-test_expect_success 'another test, without options' 'test_cmp expect out'
-
-cat << EOF > expect
-diff --git a/x b/x
-index d99af23..8b32fb5 100644
-EOF
-git diff -w > out
-test_expect_success 'another test, with -w' 'test_cmp expect out'
-
-tr 'Q' '\015' << EOF > expect
-diff --git a/x b/x
-index d99af23..8b32fb5 100644
---- a/x
-+++ b/x
-@@ -1,6 +1,6 @@
--whitespace at beginning
-+ whitespace at beginning
-whitespace change
--whitespace in the middle
-+white space in the middle
-whitespace at end
-unchanged line
-CR at endQ
-EOF
-git diff -b > out
-test_expect_success 'another test, with -b' 'test_cmp expect out'
-
-test_expect_success 'check mixed spaces and tabs in indent' '
-
- # This is indented with SP HT SP.
- echo " foo();" > x &&
- git diff --check | grep "space before tab in indent"
-
-'
-
-test_expect_success 'check mixed tabs and spaces in indent' '
-
- # This is indented with HT SP HT.
- echo " foo();" > x &&
- git diff --check | grep "space before tab in indent"
-
-'
-
-test_expect_success 'check with no whitespace errors' '
-
- git commit -m "snapshot" &&
- echo "foo();" > x &&
- git diff --check
-
-'
-
-test_expect_success 'check with trailing whitespace' '
-
- echo "foo(); " > x &&
- test_must_fail git diff --check
-
-'
-
-test_expect_success 'check with space before tab in indent' '
-
- # indent has space followed by hard tab
- echo " foo();" > x &&
- test_must_fail git diff --check
-
-'
-
-test_expect_success '--check and --exit-code are not exclusive' '
-
- git checkout x &&
- git diff --check --exit-code
-
-'
-
-test_expect_success '--check and --quiet are not exclusive' '
-
- git diff --check --quiet
-
-'
-
-test_expect_success 'check staged with no whitespace errors' '
-
- echo "foo();" > x &&
- git add x &&
- git diff --cached --check
-
-'
-
-test_expect_success 'check staged with trailing whitespace' '
-
- echo "foo(); " > x &&
- git add x &&
- test_must_fail git diff --cached --check
-
-'
-
-test_expect_success 'check staged with space before tab in indent' '
-
- # indent has space followed by hard tab
- echo " foo();" > x &&
- git add x &&
- test_must_fail git diff --cached --check
-
-'
-
-test_expect_success 'check with no whitespace errors (diff-index)' '
-
- echo "foo();" > x &&
- git add x &&
- git diff-index --check HEAD
-
-'
-
-test_expect_success 'check with trailing whitespace (diff-index)' '
-
- echo "foo(); " > x &&
- git add x &&
- test_must_fail git diff-index --check HEAD
-
-'
-
-test_expect_success 'check with space before tab in indent (diff-index)' '
-
- # indent has space followed by hard tab
- echo " foo();" > x &&
- git add x &&
- test_must_fail git diff-index --check HEAD
-
-'
-
-test_expect_success 'check staged with no whitespace errors (diff-index)' '
-
- echo "foo();" > x &&
- git add x &&
- git diff-index --cached --check HEAD
-
-'
-
-test_expect_success 'check staged with trailing whitespace (diff-index)' '
-
- echo "foo(); " > x &&
- git add x &&
- test_must_fail git diff-index --cached --check HEAD
-
-'
-
-test_expect_success 'check staged with space before tab in indent (diff-index)' '
-
- # indent has space followed by hard tab
- echo " foo();" > x &&
- git add x &&
- test_must_fail git diff-index --cached --check HEAD
-
-'
-
-test_expect_success 'check with no whitespace errors (diff-tree)' '
-
- echo "foo();" > x &&
- git commit -m "new commit" x &&
- git diff-tree --check HEAD^ HEAD
-
-'
-
-test_expect_success 'check with trailing whitespace (diff-tree)' '
-
- echo "foo(); " > x &&
- git commit -m "another commit" x &&
- test_must_fail git diff-tree --check HEAD^ HEAD
-
-'
-
-test_expect_success 'check with space before tab in indent (diff-tree)' '
-
- # indent has space followed by hard tab
- echo " foo();" > x &&
- git commit -m "yet another" x &&
- test_must_fail git diff-tree --check HEAD^ HEAD
-
-'
-
-test_expect_success 'check trailing whitespace (trailing-space: off)' '
-
- git config core.whitespace "-trailing-space" &&
- echo "foo (); " > x &&
- git diff --check
-
-'
-
-test_expect_success 'check trailing whitespace (trailing-space: on)' '
-
- git config core.whitespace "trailing-space" &&
- echo "foo (); " > x &&
- test_must_fail git diff --check
-
-'
-
-test_expect_success 'check space before tab in indent (space-before-tab: off)' '
-
- # indent contains space followed by HT
- git config core.whitespace "-space-before-tab" &&
- echo " foo ();" > x &&
- git diff --check
-
-'
-
-test_expect_success 'check space before tab in indent (space-before-tab: on)' '
-
- # indent contains space followed by HT
- git config core.whitespace "space-before-tab" &&
- echo " foo (); " > x &&
- test_must_fail git diff --check
-
-'
-
-test_expect_success 'check spaces as indentation (indent-with-non-tab: off)' '
-
- git config core.whitespace "-indent-with-non-tab"
- echo " foo ();" > x &&
- git diff --check
-
-'
-
-test_expect_success 'check spaces as indentation (indent-with-non-tab: on)' '
-
- git config core.whitespace "indent-with-non-tab" &&
- echo " foo ();" > x &&
- test_must_fail git diff --check
-
-'
-
-test_expect_success 'check tabs and spaces as indentation (indent-with-non-tab: on)' '
-
- git config core.whitespace "indent-with-non-tab" &&
- echo " foo ();" > x &&
- test_must_fail git diff --check
-
-'
-
-test_expect_success 'line numbers in --check output are correct' '
-
- echo "" > x &&
- echo "foo(); " >> x &&
- git diff --check | grep "x:2:"
-
-'
-
-test_expect_success 'checkdiff detects trailing blank lines' '
- echo "foo();" >x &&
- echo "" >>x &&
- git diff --check | grep "ends with blank"
-'
-
-test_expect_success 'checkdiff allows new blank lines' '
- git checkout x &&
- mv x y &&
- (
- echo "/* This is new */" &&
- echo "" &&
- cat y
- ) >x &&
- git diff --check
-'
-
-test_expect_success 'combined diff with autocrlf conversion' '
-
- git reset --hard &&
- echo >x hello &&
- git commit -m "one side" x &&
- git checkout HEAD^ &&
- echo >x goodbye &&
- git commit -m "the other side" x &&
- git config core.autocrlf true &&
- test_must_fail git merge master &&
-
- git diff | sed -e "1,/^@@@/d" >actual &&
- ! grep "^-" actual
-
-'
-
-test_done
-
+#!/bin/sh
+#
+# Copyright (c) 2006 Johannes E. Schindelin
+#
+
+test_description='Test special whitespace in diff engine.
+
+'
+. ./test-lib.sh
+. ../diff-lib.sh
+
+# Ray Lehtiniemi's example
+
+cat << EOF > x
+do {
+ nothing;
+} while (0);
+EOF
+
+git update-index --add x
+
+cat << EOF > x
+do
+{
+ nothing;
+}
+while (0);
+EOF
+
+cat << EOF > expect
+diff --git a/x b/x
+index adf3937..6edc172 100644
+--- a/x
++++ b/x
+@@ -1,3 +1,5 @@
+-do {
++do
++{
+ nothing;
+-} while (0);
++}
++while (0);
+EOF
+
+git diff > out
+test_expect_success "Ray's example without options" 'test_cmp expect out'
+
+git diff -w > out
+test_expect_success "Ray's example with -w" 'test_cmp expect out'
+
+git diff -b > out
+test_expect_success "Ray's example with -b" 'test_cmp expect out'
+
+tr 'Q' '\015' << EOF > x
+whitespace at beginning
+whitespace change
+whitespace in the middle
+whitespace at end
+unchanged line
+CR at endQ
+EOF
+
+git update-index x
+
+tr '_' ' ' << EOF > x
+ whitespace at beginning
+whitespace change
+white space in the middle
+whitespace at end__
+unchanged line
+CR at end
+EOF
+
+tr 'Q_' '\015 ' << EOF > expect
+diff --git a/x b/x
+index d99af23..8b32fb5 100644
+--- a/x
++++ b/x
+@@ -1,6 +1,6 @@
+-whitespace at beginning
+-whitespace change
+-whitespace in the middle
+-whitespace at end
++ whitespace at beginning
++whitespace change
++white space in the middle
++whitespace at end__
+unchanged line
+-CR at endQ
++CR at end
+EOF
+git diff > out
+test_expect_success 'another test, without options' 'test_cmp expect out'
+
+cat << EOF > expect
+diff --git a/x b/x
+index d99af23..8b32fb5 100644
+EOF
+git diff -w > out
+test_expect_success 'another test, with -w' 'test_cmp expect out'
+
+tr 'Q' '\015' << EOF > expect
+diff --git a/x b/x
+index d99af23..8b32fb5 100644
+--- a/x
++++ b/x
+@@ -1,6 +1,6 @@
+-whitespace at beginning
++ whitespace at beginning
+whitespace change
+-whitespace in the middle
++white space in the middle
+whitespace at end
+unchanged line
+CR at endQ
+EOF
+git diff -b > out
+test_expect_success 'another test, with -b' 'test_cmp expect out'
+
+test_expect_success 'check mixed spaces and tabs in indent' '
+
+ # This is indented with SP HT SP.
+ echo " foo();" > x &&
+ git diff --check | grep "space before tab in indent"
+
+'
+
+test_expect_success 'check mixed tabs and spaces in indent' '
+
+ # This is indented with HT SP HT.
+ echo " foo();" > x &&
+ git diff --check | grep "space before tab in indent"
+
+'
+
+test_expect_success 'check with no whitespace errors' '
+
+ git commit -m "snapshot" &&
+ echo "foo();" > x &&
+ git diff --check
+
+'
+
+test_expect_success 'check with trailing whitespace' '
+
+ echo "foo(); " > x &&
+ test_must_fail git diff --check
+
+'
+
+test_expect_success 'check with space before tab in indent' '
+
+ # indent has space followed by hard tab
+ echo " foo();" > x &&
+ test_must_fail git diff --check
+
+'
+
+test_expect_success '--check and --exit-code are not exclusive' '
+
+ git checkout x &&
+ git diff --check --exit-code
+
+'
+
+test_expect_success '--check and --quiet are not exclusive' '
+
+ git diff --check --quiet
+
+'
+
+test_expect_success 'check staged with no whitespace errors' '
+
+ echo "foo();" > x &&
+ git add x &&
+ git diff --cached --check
+
+'
+
+test_expect_success 'check staged with trailing whitespace' '
+
+ echo "foo(); " > x &&
+ git add x &&
+ test_must_fail git diff --cached --check
+
+'
+
+test_expect_success 'check staged with space before tab in indent' '
+
+ # indent has space followed by hard tab
+ echo " foo();" > x &&
+ git add x &&
+ test_must_fail git diff --cached --check
+
+'
+
+test_expect_success 'check with no whitespace errors (diff-index)' '
+
+ echo "foo();" > x &&
+ git add x &&
+ git diff-index --check HEAD
+
+'
+
+test_expect_success 'check with trailing whitespace (diff-index)' '
+
+ echo "foo(); " > x &&
+ git add x &&
+ test_must_fail git diff-index --check HEAD
+
+'
+
+test_expect_success 'check with space before tab in indent (diff-index)' '
+
+ # indent has space followed by hard tab
+ echo " foo();" > x &&
+ git add x &&
+ test_must_fail git diff-index --check HEAD
+
+'
+
+test_expect_success 'check staged with no whitespace errors (diff-index)' '
+
+ echo "foo();" > x &&
+ git add x &&
+ git diff-index --cached --check HEAD
+
+'
+
+test_expect_success 'check staged with trailing whitespace (diff-index)' '
+
+ echo "foo(); " > x &&
+ git add x &&
+ test_must_fail git diff-index --cached --check HEAD
+
+'
+
+test_expect_success 'check staged with space before tab in indent (diff-index)' '
+
+ # indent has space followed by hard tab
+ echo " foo();" > x &&
+ git add x &&
+ test_must_fail git diff-index --cached --check HEAD
+
+'
+
+test_expect_success 'check with no whitespace errors (diff-tree)' '
+
+ echo "foo();" > x &&
+ git commit -m "new commit" x &&
+ git diff-tree --check HEAD^ HEAD
+
+'
+
+test_expect_success 'check with trailing whitespace (diff-tree)' '
+
+ echo "foo(); " > x &&
+ git commit -m "another commit" x &&
+ test_must_fail git diff-tree --check HEAD^ HEAD
+
+'
+
+test_expect_success 'check with space before tab in indent (diff-tree)' '
+
+ # indent has space followed by hard tab
+ echo " foo();" > x &&
+ git commit -m "yet another" x &&
+ test_must_fail git diff-tree --check HEAD^ HEAD
+
+'
+
+test_expect_success 'check trailing whitespace (trailing-space: off)' '
+
+ git config core.whitespace "-trailing-space" &&
+ echo "foo (); " > x &&
+ git diff --check
+
+'
+
+test_expect_success 'check trailing whitespace (trailing-space: on)' '
+
+ git config core.whitespace "trailing-space" &&
+ echo "foo (); " > x &&
+ test_must_fail git diff --check
+
+'
+
+test_expect_success 'check space before tab in indent (space-before-tab: off)' '
+
+ # indent contains space followed by HT
+ git config core.whitespace "-space-before-tab" &&
+ echo " foo ();" > x &&
+ git diff --check
+
+'
+
+test_expect_success 'check space before tab in indent (space-before-tab: on)' '
+
+ # indent contains space followed by HT
+ git config core.whitespace "space-before-tab" &&
+ echo " foo (); " > x &&
+ test_must_fail git diff --check
+
+'
+
+test_expect_success 'check spaces as indentation (indent-with-non-tab: off)' '
+
+ git config core.whitespace "-indent-with-non-tab"
+ echo " foo ();" > x &&
+ git diff --check
+
+'
+
+test_expect_success 'check spaces as indentation (indent-with-non-tab: on)' '
+
+ git config core.whitespace "indent-with-non-tab" &&
+ echo " foo ();" > x &&
+ test_must_fail git diff --check
+
+'
+
+test_expect_success 'check tabs and spaces as indentation (indent-with-non-tab: on)' '
+
+ git config core.whitespace "indent-with-non-tab" &&
+ echo " foo ();" > x &&
+ test_must_fail git diff --check
+
+'
+
+test_expect_success 'line numbers in --check output are correct' '
+
+ echo "" > x &&
+ echo "foo(); " >> x &&
+ git diff --check | grep "x:2:"
+
+'
+
+test_expect_success 'checkdiff detects trailing blank lines' '
+ echo "foo();" >x &&
+ echo "" >>x &&
+ git diff --check | grep "ends with blank"
+'
+
+test_expect_success 'checkdiff allows new blank lines' '
+ git checkout x &&
+ mv x y &&
+ (
+ echo "/* This is new */" &&
+ echo "" &&
+ cat y
+ ) >x &&
+ git diff --check
+'
+
+test_expect_success 'combined diff with autocrlf conversion' '
+
+ git reset --hard &&
+ echo >x hello &&
+ git commit -m "one side" x &&
+ git checkout HEAD^ &&
+ echo >x goodbye &&
+ git commit -m "the other side" x &&
+ git config core.autocrlf true &&
+ test_must_fail git merge master &&
+
+ git diff | sed -e "1,/^@@@/d" >actual &&
+ ! grep "^-" actual
+
+'
+
+test_done
+
diff --git a/src/test/resources/mocks/5B.txt b/java-diff-utils/src/test/resources/mocks/5B.txt
similarity index 96%
rename from src/test/resources/mocks/5B.txt
rename to java-diff-utils/src/test/resources/mocks/5B.txt
index dd12cf4..112cff5 100644
--- a/src/test/resources/mocks/5B.txt
+++ b/java-diff-utils/src/test/resources/mocks/5B.txt
@@ -1,381 +1,381 @@
-#!/bin/sh
-#
-# Copyright (c) 2006 Johannes E. Schindelin
-#
-
-test_description='Test special whitespace in diff engine.
-
-'
-. ./test-lib.sh
-. ../diff-lib.sh
-
-# Ray Lehtiniemi's example
-
-cat << EOF > x
-do {
- nothing;
-} while (0);
-EOF
-
-git update-index --add x
-
-cat << EOF > x
-do
-{
- nothing;
-}
-while (0);
-EOF
-
-cat << EOF > expect
-diff --git a/x b/x
-index adf3937..6edc172 100644
---- a/x
-+++ b/x
-@@ -1,3 +1,5 @@
--do {
-+do
-+{
- nothing;
--} while (0);
-+}
-+while (0);
-EOF
-
-git diff > out
-test_expect_success "Ray's example without options" 'test_cmp expect out'
-
-git diff -w > out
-test_expect_success "Ray's example with -w" 'test_cmp expect out'
-
-git diff -b > out
-test_expect_success "Ray's example with -b" 'test_cmp expect out'
-
-tr 'Q' '\015' << EOF > x
-whitespace at beginning
-whitespace change
-whitespace in the middle
-whitespace at end
-unchanged line
-CR at endQ
-EOF
-
-git update-index x
-
-tr '_' ' ' << EOF > x
- whitespace at beginning
-whitespace change
-white space in the middle
-whitespace at end__
-unchanged line
-CR at end
-EOF
-
-tr 'Q_' '\015 ' << EOF > expect
-diff --git a/x b/x
-index d99af23..8b32fb5 100644
---- a/x
-+++ b/x
-@@ -1,6 +1,6 @@
--whitespace at beginning
--whitespace change
--whitespace in the middle
--whitespace at end
-+ whitespace at beginning
-+whitespace change
-+white space in the middle
-+whitespace at end__
-unchanged line
--CR at endQ
-+CR at end
-EOF
-git diff > out
-test_expect_success 'another test, without options' 'test_cmp expect out'
-
-cat << EOF > expect
-diff --git a/x b/x
-index d99af23..8b32fb5 100644
-EOF
-git diff -w > out
-test_expect_success 'another test, with -w' 'test_cmp expect out'
-
-tr 'Q' '\015' << EOF > expect
-diff --git a/x b/x
-index d99af23..8b32fb5 100644
---- a/x
-+++ b/x
-@@ -1,6 +1,6 @@
--whitespace at beginning
-+ whitespace at beginning
-whitespace change
--whitespace in the middle
-+white space in the middle
-whitespace at end
-unchanged line
-CR at endQ
-git diff -b --ignore-space-at-eol > out
-test_expect_failure 'another test, with -b --ignore-space-at-eol' 'test_cmp expect out'
-
-tr 'Q' '\015' << EOF > expect
-diff --git a/x b/x
-index d99af23..8b32fb5 100644
---- a/x
-+++ b/x
-EOF
-git diff -b > out
-test_expect_success 'another test, with -b' 'test_cmp expect out'
-
-test_expect_success 'check mixed spaces and tabs in indent' '
-
- # This is indented with SP HT SP.
- echo " foo();" > x &&
- git diff --check | grep "space before tab in indent"
-
-'
-
-test_expect_success 'check mixed tabs and spaces in indent' '
-
- # This is indented with HT SP HT.
- echo " foo();" > x &&
- git diff --check | grep "space before tab in indent"
-
-'
-
-test_expect_success 'check with no whitespace errors' '
-
- git commit -m "snapshot" &&
- echo "foo();" > x &&
- git diff --check
-
-'
-
-test_expect_success 'check with trailing whitespace' '
-
- echo "foo(); " > x &&
- test_must_fail git diff --check
-
-'
-
-test_expect_success 'check with space before tab in indent' '
-
- # indent has space followed by hard tab
- echo " foo();" > x &&
- test_must_fail git diff --check
-
-'
-
-test_expect_success '--check and --exit-code are not exclusive' '
-
- git checkout x &&
- git diff --check --exit-code
-
-'
-
-test_expect_success '--check and --quiet are not exclusive' '
-
- git diff --check --quiet
-
-'
-
-test_expect_success 'check staged with no whitespace errors' '
-
- echo "foo();" > x &&
- git add x &&
- git diff --cached --check
-
-'
-
-test_expect_success 'check staged with trailing whitespace' '
-
- echo "foo(); " > x &&
- git add x &&
- test_must_fail git diff --cached --check
-
-'
-
-test_expect_success 'check staged with space before tab in indent' '
-
- # indent has space followed by hard tab
- echo " foo();" > x &&
- git add x &&
- test_must_fail git diff --cached --check
-
-'
-
-test_expect_success 'check with no whitespace errors (diff-index)' '
-
- echo "foo();" > x &&
- git add x &&
- git diff-index --check HEAD
-
-'
-
-test_expect_success 'check with trailing whitespace (diff-index)' '
-
- echo "foo(); " > x &&
- git add x &&
- test_must_fail git diff-index --check HEAD
-
-'
-
-test_expect_success 'check with space before tab in indent (diff-index)' '
-
- # indent has space followed by hard tab
- echo " foo();" > x &&
- git add x &&
- test_must_fail git diff-index --check HEAD
-
-'
-
-test_expect_success 'check staged with no whitespace errors (diff-index)' '
-
- echo "foo();" > x &&
- git add x &&
- git diff-index --cached --check HEAD
-
-'
-
-test_expect_success 'check staged with trailing whitespace (diff-index)' '
-
- echo "foo(); " > x &&
- git add x &&
- test_must_fail git diff-index --cached --check HEAD
-
-'
-
-test_expect_success 'check staged with space before tab in indent (diff-index)' '
-
- # indent has space followed by hard tab
- echo " foo();" > x &&
- git add x &&
- test_must_fail git diff-index --cached --check HEAD
-
-'
-
-test_expect_success 'check with no whitespace errors (diff-tree)' '
-
- echo "foo();" > x &&
- git commit -m "new commit" x &&
- git diff-tree --check HEAD^ HEAD
-
-'
-
-test_expect_success 'check with trailing whitespace (diff-tree)' '
-
- echo "foo(); " > x &&
- git commit -m "another commit" x &&
- test_must_fail git diff-tree --check HEAD^ HEAD
-
-'
-
-test_expect_success 'check with space before tab in indent (diff-tree)' '
-
- # indent has space followed by hard tab
- echo " foo();" > x &&
- git commit -m "yet another" x &&
- test_must_fail git diff-tree --check HEAD^ HEAD
-
-'
-
-test_expect_success 'check trailing whitespace (trailing-space: off)' '
-
- git config core.whitespace "-trailing-space" &&
- echo "foo (); " > x &&
- git diff --check
-
-'
-
-test_expect_success 'check trailing whitespace (trailing-space: on)' '
-
- git config core.whitespace "trailing-space" &&
- echo "foo (); " > x &&
- test_must_fail git diff --check
-
-'
-
-test_expect_success 'check space before tab in indent (space-before-tab: off)' '
-
- # indent contains space followed by HT
- git config core.whitespace "-space-before-tab" &&
- echo " foo ();" > x &&
- git diff --check
-
-'
-
-test_expect_success 'check space before tab in indent (space-before-tab: on)' '
-
- # indent contains space followed by HT
- git config core.whitespace "space-before-tab" &&
- echo " foo (); " > x &&
- test_must_fail git diff --check
-
-'
-
-test_expect_success 'check spaces as indentation (indent-with-non-tab: off)' '
-
- git config core.whitespace "-indent-with-non-tab"
- echo " foo ();" > x &&
- git diff --check
-
-'
-
-test_expect_success 'check spaces as indentation (indent-with-non-tab: on)' '
-
- git config core.whitespace "indent-with-non-tab" &&
- echo " foo ();" > x &&
- test_must_fail git diff --check
-
-'
-
-test_expect_success 'check tabs and spaces as indentation (indent-with-non-tab: on)' '
-
- git config core.whitespace "indent-with-non-tab" &&
- echo " foo ();" > x &&
- test_must_fail git diff --check
-
-'
-
-test_expect_success 'line numbers in --check output are correct' '
-
- echo "" > x &&
- echo "foo(); " >> x &&
- git diff --check | grep "x:2:"
-
-'
-
-test_expect_success 'checkdiff detects trailing blank lines' '
- echo "foo();" >x &&
- echo "" >>x &&
- git diff --check | grep "ends with blank"
-'
-
-test_expect_success 'checkdiff allows new blank lines' '
- git checkout x &&
- mv x y &&
- (
- echo "/* This is new */" &&
- echo "" &&
- cat y
- ) >x &&
- git diff --check
-'
-
-test_expect_success 'combined diff with autocrlf conversion' '
-
- git reset --hard &&
- echo >x hello &&
- git commit -m "one side" x &&
- git checkout HEAD^ &&
- echo >x goodbye &&
- git commit -m "the other side" x &&
- git config core.autocrlf true &&
- test_must_fail git merge master &&
-
- git diff | sed -e "1,/^@@@/d" >actual &&
- ! grep "^-" actual
-
-'
-
-test_done
-
-
+#!/bin/sh
+#
+# Copyright (c) 2006 Johannes E. Schindelin
+#
+
+test_description='Test special whitespace in diff engine.
+
+'
+. ./test-lib.sh
+. ../diff-lib.sh
+
+# Ray Lehtiniemi's example
+
+cat << EOF > x
+do {
+ nothing;
+} while (0);
+EOF
+
+git update-index --add x
+
+cat << EOF > x
+do
+{
+ nothing;
+}
+while (0);
+EOF
+
+cat << EOF > expect
+diff --git a/x b/x
+index adf3937..6edc172 100644
+--- a/x
++++ b/x
+@@ -1,3 +1,5 @@
+-do {
++do
++{
+ nothing;
+-} while (0);
++}
++while (0);
+EOF
+
+git diff > out
+test_expect_success "Ray's example without options" 'test_cmp expect out'
+
+git diff -w > out
+test_expect_success "Ray's example with -w" 'test_cmp expect out'
+
+git diff -b > out
+test_expect_success "Ray's example with -b" 'test_cmp expect out'
+
+tr 'Q' '\015' << EOF > x
+whitespace at beginning
+whitespace change
+whitespace in the middle
+whitespace at end
+unchanged line
+CR at endQ
+EOF
+
+git update-index x
+
+tr '_' ' ' << EOF > x
+ whitespace at beginning
+whitespace change
+white space in the middle
+whitespace at end__
+unchanged line
+CR at end
+EOF
+
+tr 'Q_' '\015 ' << EOF > expect
+diff --git a/x b/x
+index d99af23..8b32fb5 100644
+--- a/x
++++ b/x
+@@ -1,6 +1,6 @@
+-whitespace at beginning
+-whitespace change
+-whitespace in the middle
+-whitespace at end
++ whitespace at beginning
++whitespace change
++white space in the middle
++whitespace at end__
+unchanged line
+-CR at endQ
++CR at end
+EOF
+git diff > out
+test_expect_success 'another test, without options' 'test_cmp expect out'
+
+cat << EOF > expect
+diff --git a/x b/x
+index d99af23..8b32fb5 100644
+EOF
+git diff -w > out
+test_expect_success 'another test, with -w' 'test_cmp expect out'
+
+tr 'Q' '\015' << EOF > expect
+diff --git a/x b/x
+index d99af23..8b32fb5 100644
+--- a/x
++++ b/x
+@@ -1,6 +1,6 @@
+-whitespace at beginning
++ whitespace at beginning
+whitespace change
+-whitespace in the middle
++white space in the middle
+whitespace at end
+unchanged line
+CR at endQ
+git diff -b --ignore-space-at-eol > out
+test_expect_failure 'another test, with -b --ignore-space-at-eol' 'test_cmp expect out'
+
+tr 'Q' '\015' << EOF > expect
+diff --git a/x b/x
+index d99af23..8b32fb5 100644
+--- a/x
++++ b/x
+EOF
+git diff -b > out
+test_expect_success 'another test, with -b' 'test_cmp expect out'
+
+test_expect_success 'check mixed spaces and tabs in indent' '
+
+ # This is indented with SP HT SP.
+ echo " foo();" > x &&
+ git diff --check | grep "space before tab in indent"
+
+'
+
+test_expect_success 'check mixed tabs and spaces in indent' '
+
+ # This is indented with HT SP HT.
+ echo " foo();" > x &&
+ git diff --check | grep "space before tab in indent"
+
+'
+
+test_expect_success 'check with no whitespace errors' '
+
+ git commit -m "snapshot" &&
+ echo "foo();" > x &&
+ git diff --check
+
+'
+
+test_expect_success 'check with trailing whitespace' '
+
+ echo "foo(); " > x &&
+ test_must_fail git diff --check
+
+'
+
+test_expect_success 'check with space before tab in indent' '
+
+ # indent has space followed by hard tab
+ echo " foo();" > x &&
+ test_must_fail git diff --check
+
+'
+
+test_expect_success '--check and --exit-code are not exclusive' '
+
+ git checkout x &&
+ git diff --check --exit-code
+
+'
+
+test_expect_success '--check and --quiet are not exclusive' '
+
+ git diff --check --quiet
+
+'
+
+test_expect_success 'check staged with no whitespace errors' '
+
+ echo "foo();" > x &&
+ git add x &&
+ git diff --cached --check
+
+'
+
+test_expect_success 'check staged with trailing whitespace' '
+
+ echo "foo(); " > x &&
+ git add x &&
+ test_must_fail git diff --cached --check
+
+'
+
+test_expect_success 'check staged with space before tab in indent' '
+
+ # indent has space followed by hard tab
+ echo " foo();" > x &&
+ git add x &&
+ test_must_fail git diff --cached --check
+
+'
+
+test_expect_success 'check with no whitespace errors (diff-index)' '
+
+ echo "foo();" > x &&
+ git add x &&
+ git diff-index --check HEAD
+
+'
+
+test_expect_success 'check with trailing whitespace (diff-index)' '
+
+ echo "foo(); " > x &&
+ git add x &&
+ test_must_fail git diff-index --check HEAD
+
+'
+
+test_expect_success 'check with space before tab in indent (diff-index)' '
+
+ # indent has space followed by hard tab
+ echo " foo();" > x &&
+ git add x &&
+ test_must_fail git diff-index --check HEAD
+
+'
+
+test_expect_success 'check staged with no whitespace errors (diff-index)' '
+
+ echo "foo();" > x &&
+ git add x &&
+ git diff-index --cached --check HEAD
+
+'
+
+test_expect_success 'check staged with trailing whitespace (diff-index)' '
+
+ echo "foo(); " > x &&
+ git add x &&
+ test_must_fail git diff-index --cached --check HEAD
+
+'
+
+test_expect_success 'check staged with space before tab in indent (diff-index)' '
+
+ # indent has space followed by hard tab
+ echo " foo();" > x &&
+ git add x &&
+ test_must_fail git diff-index --cached --check HEAD
+
+'
+
+test_expect_success 'check with no whitespace errors (diff-tree)' '
+
+ echo "foo();" > x &&
+ git commit -m "new commit" x &&
+ git diff-tree --check HEAD^ HEAD
+
+'
+
+test_expect_success 'check with trailing whitespace (diff-tree)' '
+
+ echo "foo(); " > x &&
+ git commit -m "another commit" x &&
+ test_must_fail git diff-tree --check HEAD^ HEAD
+
+'
+
+test_expect_success 'check with space before tab in indent (diff-tree)' '
+
+ # indent has space followed by hard tab
+ echo " foo();" > x &&
+ git commit -m "yet another" x &&
+ test_must_fail git diff-tree --check HEAD^ HEAD
+
+'
+
+test_expect_success 'check trailing whitespace (trailing-space: off)' '
+
+ git config core.whitespace "-trailing-space" &&
+ echo "foo (); " > x &&
+ git diff --check
+
+'
+
+test_expect_success 'check trailing whitespace (trailing-space: on)' '
+
+ git config core.whitespace "trailing-space" &&
+ echo "foo (); " > x &&
+ test_must_fail git diff --check
+
+'
+
+test_expect_success 'check space before tab in indent (space-before-tab: off)' '
+
+ # indent contains space followed by HT
+ git config core.whitespace "-space-before-tab" &&
+ echo " foo ();" > x &&
+ git diff --check
+
+'
+
+test_expect_success 'check space before tab in indent (space-before-tab: on)' '
+
+ # indent contains space followed by HT
+ git config core.whitespace "space-before-tab" &&
+ echo " foo (); " > x &&
+ test_must_fail git diff --check
+
+'
+
+test_expect_success 'check spaces as indentation (indent-with-non-tab: off)' '
+
+ git config core.whitespace "-indent-with-non-tab"
+ echo " foo ();" > x &&
+ git diff --check
+
+'
+
+test_expect_success 'check spaces as indentation (indent-with-non-tab: on)' '
+
+ git config core.whitespace "indent-with-non-tab" &&
+ echo " foo ();" > x &&
+ test_must_fail git diff --check
+
+'
+
+test_expect_success 'check tabs and spaces as indentation (indent-with-non-tab: on)' '
+
+ git config core.whitespace "indent-with-non-tab" &&
+ echo " foo ();" > x &&
+ test_must_fail git diff --check
+
+'
+
+test_expect_success 'line numbers in --check output are correct' '
+
+ echo "" > x &&
+ echo "foo(); " >> x &&
+ git diff --check | grep "x:2:"
+
+'
+
+test_expect_success 'checkdiff detects trailing blank lines' '
+ echo "foo();" >x &&
+ echo "" >>x &&
+ git diff --check | grep "ends with blank"
+'
+
+test_expect_success 'checkdiff allows new blank lines' '
+ git checkout x &&
+ mv x y &&
+ (
+ echo "/* This is new */" &&
+ echo "" &&
+ cat y
+ ) >x &&
+ git diff --check
+'
+
+test_expect_success 'combined diff with autocrlf conversion' '
+
+ git reset --hard &&
+ echo >x hello &&
+ git commit -m "one side" x &&
+ git checkout HEAD^ &&
+ echo >x goodbye &&
+ git commit -m "the other side" x &&
+ git config core.autocrlf true &&
+ test_must_fail git merge master &&
+
+ git diff | sed -e "1,/^@@@/d" >actual &&
+ ! grep "^-" actual
+
+'
+
+test_done
+
+
diff --git a/src/test/resources/mocks/issue10_base.txt b/java-diff-utils/src/test/resources/mocks/issue10_base.txt
similarity index 100%
rename from src/test/resources/mocks/issue10_base.txt
rename to java-diff-utils/src/test/resources/mocks/issue10_base.txt
diff --git a/src/test/resources/mocks/issue10_patch.txt b/java-diff-utils/src/test/resources/mocks/issue10_patch.txt
similarity index 100%
rename from src/test/resources/mocks/issue10_patch.txt
rename to java-diff-utils/src/test/resources/mocks/issue10_patch.txt
diff --git a/src/test/resources/mocks/issue11_1.txt b/java-diff-utils/src/test/resources/mocks/issue11_1.txt
similarity index 100%
rename from src/test/resources/mocks/issue11_1.txt
rename to java-diff-utils/src/test/resources/mocks/issue11_1.txt
diff --git a/src/test/resources/mocks/issue11_2.txt b/java-diff-utils/src/test/resources/mocks/issue11_2.txt
similarity index 100%
rename from src/test/resources/mocks/issue11_2.txt
rename to java-diff-utils/src/test/resources/mocks/issue11_2.txt
diff --git a/src/test/resources/mocks/issue15_1.txt b/java-diff-utils/src/test/resources/mocks/issue15_1.txt
similarity index 100%
rename from src/test/resources/mocks/issue15_1.txt
rename to java-diff-utils/src/test/resources/mocks/issue15_1.txt
diff --git a/src/test/resources/mocks/issue15_2.txt b/java-diff-utils/src/test/resources/mocks/issue15_2.txt
similarity index 100%
rename from src/test/resources/mocks/issue15_2.txt
rename to java-diff-utils/src/test/resources/mocks/issue15_2.txt
diff --git a/src/test/resources/mocks/one_delta_test_original.txt b/java-diff-utils/src/test/resources/mocks/one_delta_test_original.txt
similarity index 100%
rename from src/test/resources/mocks/one_delta_test_original.txt
rename to java-diff-utils/src/test/resources/mocks/one_delta_test_original.txt
diff --git a/src/test/resources/mocks/one_delta_test_revised.txt b/java-diff-utils/src/test/resources/mocks/one_delta_test_revised.txt
similarity index 100%
rename from src/test/resources/mocks/one_delta_test_revised.txt
rename to java-diff-utils/src/test/resources/mocks/one_delta_test_revised.txt
diff --git a/src/test/resources/mocks/original.txt b/java-diff-utils/src/test/resources/mocks/original.txt
similarity index 100%
rename from src/test/resources/mocks/original.txt
rename to java-diff-utils/src/test/resources/mocks/original.txt
diff --git a/src/test/resources/mocks/revised.txt b/java-diff-utils/src/test/resources/mocks/revised.txt
similarity index 100%
rename from src/test/resources/mocks/revised.txt
rename to java-diff-utils/src/test/resources/mocks/revised.txt
diff --git a/pom.xml b/pom.xml
index b7ca5ea..8563cdf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,10 +1,14 @@
-
+
+
4.0.0
io.github.java-diff-utils
- java-diff-utils
- jar
+ java-diff-utils-parent
4.1-SNAPSHOT
- java-diff-utils
+ pom
+
+ java-diff-utils
+ java-diff-utils-jgit
+
The DiffUtils library for computing diffs, applying patches, generationg side-by-side view in Java.
https://github.com/java-diff-utils/java-diff-utils
2009
@@ -26,7 +30,6 @@
https://github.com/java-diff-utils/java-diff-utils.git
HEAD
-
GitHub Issues
https://github.com/java-diff-utils/java-diff-utils/issues
@@ -41,16 +44,6 @@
Tobias Warneke
t.warneke@gmx.net
-
@@ -61,87 +54,21 @@
A business-friendly OSS license
-
UTF-8
+ 1.8
+ 1.8
-
-
-
- junit
- junit
- 4.12
- jar
- test
-
-
- org.eclipse.jgit
- org.eclipse.jgit
- 4.4.1.201607150455-r
-
-
- com.googlecode.javaewah
- JavaEWAH
-
-
- commons-codec
- commons-codec
-
-
- commons-logging
- commons-logging
-
-
- org.apache.httpcomponents
- httpclient
-
-
- com.jcraft
- jsch
-
-
- org.slf4j
- slf4j-api
-
-
-
-
- org.assertj
- assertj-core
- 3.11.1
- test
-
-
-
-
org.apache.maven.plugins
- maven-compiler-plugin
- 3.6.1
+ maven-release-plugin
+ 2.5.3
- 1.8
- 1.8
- UTF-8
-
-
-
-
-
-
- maven-jar-plugin
- 3.0.2
-
-
- ${project.build.outputDirectory}/META-INF/MANIFEST.MF
-
-
- com.github.wumpz.diffutils
-
-
+ true
+ false
+ forked-path
@@ -174,26 +101,6 @@
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 2.19.1
-
-
- **/LR*.java
-
-
-
-
- org.apache.maven.plugins
- maven-release-plugin
- 2.5.3
-
- true
- false
- forked-path
-
-
org.apache.maven.plugins
maven-checkstyle-plugin
@@ -215,12 +122,6 @@
-
@@ -253,6 +154,16 @@
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.22.1
+
+
+ **/LR*.java
+
+
+
@@ -312,5 +223,4 @@
-
-
+
\ No newline at end of file