summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit
diff options
context:
space:
mode:
authorThomas Wolf <thomas.wolf@paranor.ch>2018-02-01 21:58:23 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2018-02-02 00:45:32 +0100
commitfc7d407d0bd056534f2407d8532cc035617b08d6 (patch)
treec5a2c2186b23509f295716cf28406ec32add71b1 /org.eclipse.jgit.junit
parent4e0e1b4e86a98e87b5e9febe3c7d019300a99a22 (diff)
downloadjgit-fc7d407d0bd056534f2407d8532cc035617b08d6.tar.gz
jgit-fc7d407d0bd056534f2407d8532cc035617b08d6.zip
Honor CRLF settings when writing merge results
Merges are performed using the raw text as stored in the git repository. When we write the merge result, we must apply the correct CRLF settings. Otherwise the line endings in the result will be wrong. Bug: 499615 Change-Id: I37a9b987e9404c97645d2720cd1c7c04c076a96b Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.junit')
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java
index 044f08072a..8f44620b80 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java
@@ -197,14 +197,14 @@ public abstract class RepositoryTestCase extends LocalDiskRepositoryTestCase {
*/
protected static void checkFile(File f, final String checkData)
throws IOException {
- Reader r = new InputStreamReader(new FileInputStream(f), "UTF-8");
- try {
- char[] data = new char[checkData.length()];
- if (checkData.length() != r.read(data))
- throw new IOException("Internal error reading file data from "+f);
- assertEquals(checkData, new String(data));
- } finally {
- r.close();
+ try (Reader r = new InputStreamReader(new FileInputStream(f),
+ "UTF-8")) {
+ if (checkData.length() > 0) {
+ char[] data = new char[checkData.length()];
+ assertEquals(data.length, r.read(data));
+ assertEquals(checkData, new String(data));
+ }
+ assertEquals(-1, r.read());
}
}