]> source.dussan.org Git - jgit.git/commitdiff
Remove an old work-around for core.autocrlf = input 90/149390/3
authorThomas Wolf <thomas.wolf@paranor.ch>
Wed, 11 Sep 2019 19:55:53 +0000 (21:55 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Thu, 12 Sep 2019 10:02:11 +0000 (12:02 +0200)
The removed code was trying to avoid mistakenly reporting differences
when core.autocrlf was set to "input" but a file had already been
committed with CR-LF. It did that by running the blob from the cache
through a CRLF-to-LF filter because older JGit would also run the file
from the working tree through such a filter.

The real fix for this case was done in commit 60cf85a. Since then files
are not normalized if they have already been committed with CR-LF and
this old fix attempt from bug 372834 is no longer needed.

Change-Id: Ib4facc153d81325cb48b4ee956a596b423f36241
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java

index 7424c13e2cc509fd471541b4cbe9647f8c3ba71d..2dd127bc2fcef56f74702e9df2181fd8cad515c7 100644 (file)
@@ -101,7 +101,6 @@ import org.eclipse.jgit.util.Paths;
 import org.eclipse.jgit.util.RawParseUtils;
 import org.eclipse.jgit.util.TemporaryBuffer;
 import org.eclipse.jgit.util.TemporaryBuffer.LocalFile;
-import org.eclipse.jgit.util.io.AutoLFInputStream;
 import org.eclipse.jgit.util.io.EolStreamTypeUtil;
 import org.eclipse.jgit.util.sha1.SHA1;
 
@@ -1097,41 +1096,8 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
                                return !new File(readSymlinkTarget(current())).equals(
                                                new File(readContentAsNormalizedString(entry, reader)));
                        }
-                       // Content differs: that's a real change, perhaps
-                       if (reader == null) // deprecated use, do no further checks
-                               return true;
-
-                       switch (getEolStreamType()) {
-                       case DIRECT:
-                               return true;
-                       default:
-                               try {
-                                       ObjectLoader loader = reader.open(entry.getObjectId());
-                                       if (loader == null)
-                                               return true;
-
-                                       // We need to compute the length, but only if it is not
-                                       // a binary stream.
-                                       long dcInLen;
-                                       try (InputStream dcIn = new AutoLFInputStream(
-                                                       loader.openStream(), true,
-                                                       true /* abort if binary */)) {
-                                               dcInLen = computeLength(dcIn);
-                                       } catch (AutoLFInputStream.IsBinaryException e) {
-                                               return true;
-                                       }
-
-                                       try (InputStream dcIn = new AutoLFInputStream(
-                                                       loader.openStream(), true)) {
-                                               byte[] autoCrLfHash = computeHash(dcIn, dcInLen);
-                                               boolean changed = getEntryObjectId()
-                                                               .compareTo(autoCrLfHash, 0) != 0;
-                                               return changed;
-                                       }
-                               } catch (IOException e) {
-                                       return true;
-                               }
-                       }
+                       // Content differs: that's a real change
+                       return true;
                }
        }