aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorThomas Wolf <thomas.wolf@paranor.ch>2017-08-11 22:48:50 +0200
committerThomas Wolf <thomas.wolf@paranor.ch>2017-08-11 22:56:50 +0200
commita489a8ae9ad16d7f811962997e91d31a0c07f195 (patch)
tree372be371c035a2f1853a2f6cbc18c83690598f7e /org.eclipse.jgit.test
parent22201e8cca3b2b1f6df71fb1053c7358a9a2d72f (diff)
downloadjgit-a489a8ae9ad16d7f811962997e91d31a0c07f195.tar.gz
jgit-a489a8ae9ad16d7f811962997e91d31a0c07f195.zip
Ensure EOL stream type is DIRECT when -text attribute is present
Otherwise fancy combinations of attributes (binary or -text in combination with crlf or eol) may result in the corruption of binary data. Bug: 520910 Change-Id: I3ffc666c13d1b9d2ed987b69a67bfc7f42ccdbfc Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java
index ed3907e9b2..aafda0171c 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java
@@ -303,6 +303,21 @@ public class AddCommandTest extends RepositoryTestCase {
}
@Test
+ public void testAttributesConflictingMatch() throws Exception {
+ writeTrashFile(".gitattributes", "foo/** crlf=input\n*.jar binary");
+ writeTrashFile("foo/bar.jar", "\r\n");
+ // We end up with attributes [binary -diff -merge -text crlf=input].
+ // crlf should have no effect when -text is present.
+ try (Git git = new Git(db)) {
+ git.add().addFilepattern(".").call();
+ assertEquals(
+ "[.gitattributes, mode:100644, content:foo/** crlf=input\n*.jar binary]"
+ + "[foo/bar.jar, mode:100644, content:\r\n]",
+ indexState(CONTENT));
+ }
+ }
+
+ @Test
public void testCleanFilterEnvironment()
throws IOException, GitAPIException {
writeTrashFile(".gitattributes", "*.txt filter=tstFilter");