jgit/org.eclipse.jgit.test
Thomas Wolf efd1cc05af Keep line endings for text files committed with CR/LF on text=auto
Git never converts line endings if the version in the repository is a
text file with CR/LF and text=auto. See [1]: "When the file has been
committed with CRLF, no conversion is done."

Because the sentence just before is about converting line endings on
check-in, I had understood that in commit 60cf85a [2] to mean that no
conversion on check-in was to be done. However, as bug 565048 and a
code inspection of the C git code showed it really means no conversion
is done on check-in *or check-out*.

If the text attribute is not set but core.autocrlf = true, this is
the same as text=auto eol=crlf. C git does not convert on check-out
even on text=auto eol=lf if the index version is a text file with
CR/LF.

For check-in, one has to look at the intended target, which is done
in WorkingTreeIterator since commit 60cf85a. For check-out, it can
be done by looking at the source and can thus be done in the
AutoLFOutputStream.

Additionally, provide a constructor for AutoLFInputStream to do
the same; for cases where the equivalent of a check-out is done via
an input stream obtained from a blob. (EGit does that in its
GitBlobStorage for the Eclipse compare framework; it's more efficient
than using a TemporaryBuffer and DirCacheCheckout.getContent(), and
it avoids the need for a temporary file.)

Adapt existing tests, and add new checkout and merge tests to verify
the resulting files have the correct line endings.

EGit's GitBlobStorage will need to call the new version of
EolStreamTypeUtil.wrapInputStream().

[1] https://git-scm.com/docs/gitattributes#Documentation/gitattributes.txt-Settostringvalueauto
[2] https://git.eclipse.org/r/c/jgit/jgit/+/127324

Bug: 565048
Change-Id: If1282ef43e2abd00263541bd10a01fe1f5c619fc
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2020-08-17 08:52:55 +02:00
..
.settings Enable and fix "Statement unnecessarily nested within else clause" warnings 2019-10-17 10:20:14 +09:00
META-INF Prepare 5.9.0-SNAPSHOT builds 2020-06-09 12:51:12 +02:00
exttst/org/eclipse/jgit Merge branch 'stable-5.6' 2020-02-22 23:36:08 +01:00
src/org/eclipse/jgit Decouple JSch from JGit Core 2020-06-01 01:46:59 +02:00
tst/org/eclipse/jgit Keep line endings for text files committed with CR/LF on text=auto 2020-08-17 08:52:55 +02:00
tst-rsrc DirCache: support index V4 2020-08-15 12:47:45 +02:00
.classpath Decouple JSch from JGit Core 2020-06-01 01:46:59 +02:00
.gitignore Fix test setup for Eclipse Photon and greater 2018-11-02 18:50:26 +01:00
.project Remove references to org.eclipse.jgit.java7 2016-08-05 11:22:27 +09:00
BUILD Decouple JSch from JGit Core 2020-06-01 01:46:59 +02:00
build.properties Decouple JSch from JGit Core 2020-06-01 01:46:59 +02:00
org.eclipse.jgit.core--All-Tests (Java 8) (de).launch Fixed few locale dependent pgm tests 2016-01-02 17:41:58 +01:00
org.eclipse.jgit.core--All-Tests (Java 8).launch Fix classpath of test launch configurations 2015-11-21 00:33:43 +01:00
org.eclipse.jgit.core--All-Tests.launch Use JUnit4 for tests 2010-08-26 12:26:38 -05:00
org.eclipse.jgit.test-WalkEncryptionTest-Proxy.launch Adding AES Walk Encryption support in http://www.jets3t.org/ mode 2015-10-18 19:14:31 +00:00
org.eclipse.jgit.test-WalkEncryptionTest.launch Adding AES Walk Encryption support in http://www.jets3t.org/ mode 2015-10-18 19:14:31 +00:00
plugin.properties Fix bundle localization of Apache SSH bundle 2019-06-21 17:54:06 +02:00
pom.xml Prepare 5.9.0-SNAPSHOT builds 2020-06-09 12:51:12 +02:00
tests.bzl Decouple JSch from JGit Core 2020-06-01 01:46:59 +02:00