diff options
author | Thomas Wolf <thomas.wolf@paranor.ch> | 2020-03-23 16:55:35 +0100 |
---|---|---|
committer | Thomas Wolf <thomas.wolf@paranor.ch> | 2020-05-22 17:08:52 -0400 |
commit | 3c34e0acbfcac236daaf746690130c6e99a8e524 (patch) | |
tree | bd5c30242f9861d35fbba58e0f49c87db4d04294 /org.eclipse.jgit/src/org/eclipse/jgit/util/io | |
parent | 97e660e1a54b2bae4b5e830ad45c3d7b9ea9ea21 (diff) | |
download | jgit-3c34e0acbfcac236daaf746690130c6e99a8e524.tar.gz jgit-3c34e0acbfcac236daaf746690130c6e99a8e524.zip |
Attributes: fix handling of text=auto in combination with eol
In Git 2.10.0 the interpretation of gitattributes changed or was fixed
such that "* text=auto eol=crlf" would indeed still do auto-detection
of text vs. binary content.[1] Previously this was identical to
"* text eol=crlf", i.e., treating all files as text.
JGit still did the latter, which caused surprises because it changed
binary files.
[1] https://github.com/git/git/blob/master/Documentation/RelNotes/2.10.0.txt#L248
Bug: 561341
Change-Id: I5b6fb97b5e86fd950a98537b6b8574f768ae30e5
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/util/io')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/io/EolStreamTypeUtil.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/EolStreamTypeUtil.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/EolStreamTypeUtil.java index deab4e67a0..a6acb40ee3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/EolStreamTypeUtil.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/EolStreamTypeUtil.java @@ -140,19 +140,19 @@ public final class EolStreamTypeUtil { } // new git system + if ("auto".equals(attrs.getValue("text"))) { //$NON-NLS-1$ //$NON-NLS-2$ + return EolStreamType.AUTO_LF; + } + String eol = attrs.getValue("eol"); //$NON-NLS-1$ - if (eol != null) + if (eol != null) { // check-in is always normalized to LF return EolStreamType.TEXT_LF; - + } if (attrs.isSet("text")) { //$NON-NLS-1$ return EolStreamType.TEXT_LF; } - if ("auto".equals(attrs.getValue("text"))) { //$NON-NLS-1$ //$NON-NLS-2$ - return EolStreamType.AUTO_LF; - } - switch (options.getAutoCRLF()) { case TRUE: case INPUT: @@ -205,7 +205,10 @@ public final class EolStreamTypeUtil { // new git system String eol = attrs.getValue("eol"); //$NON-NLS-1$ if (eol != null) { - if ("crlf".equals(eol)) {//$NON-NLS-1$ + if ("crlf".equals(eol)) { //$NON-NLS-1$ + if ("auto".equals(attrs.getValue("text"))) { //$NON-NLS-1$ //$NON-NLS-2$ + return EolStreamType.AUTO_CRLF; + } return EolStreamType.TEXT_CRLF; } else if ("lf".equals(eol)) { //$NON-NLS-1$ return EolStreamType.DIRECT; |