diff options
author | Thomas Wolf <thomas.wolf@paranor.ch> | 2021-10-12 22:14:33 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2021-10-27 00:22:42 +0200 |
commit | b3a8a94a97d7f1370f534c2bbe069ff0e24b2da9 (patch) | |
tree | 5ee269acaf312cb3e639e5f145d6091954b0da63 /org.eclipse.jgit | |
parent | fc6fe793ce5c17a9270de443d09e38ff2fa45a43 (diff) | |
download | jgit-b3a8a94a97d7f1370f534c2bbe069ff0e24b2da9.tar.gz jgit-b3a8a94a97d7f1370f534c2bbe069ff0e24b2da9.zip |
Fix checkout of files with mixed line endings on text=auto eol=crlf
Add tests for files having been checked in with mixed LF and CR-LF
line endings, and then being checked out with text or text=auto and
eol=lf or eol=crlf. These test cases were missing, and thus commit
efd1cc05 missed that AutoCRLFOutputStream needs the same detection
as AutoLFOutputStream.
Fix AutoCRLFOutputStream to not convert line endings if the blob in
the repository contains CR-LF.
Bug: 575393
Change-Id: Id0c7ae772e282097e95fddcd3f1f9d82aae31e43
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/io/AutoCRLFOutputStream.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/AutoCRLFOutputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/AutoCRLFOutputStream.java index ea6b6588cf..97fe01e5d9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/AutoCRLFOutputStream.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/AutoCRLFOutputStream.java @@ -137,6 +137,9 @@ public class AutoCRLFOutputStream extends OutputStream { private void decideMode() throws IOException { if (detectBinary) { isBinary = RawText.isBinary(binbuf, binbufcnt); + if (!isBinary) { + isBinary = RawText.isCrLfText(binbuf, binbufcnt); + } detectBinary = false; } int cachedLen = binbufcnt; |