summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorJörg Kubitz <jkubitz-eclipse@gmx.de>2022-08-31 17:02:54 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2022-09-20 10:00:17 +0200
commiteb5124c74f9bcdedc8492a8c1eddc734adfb7226 (patch)
tree91a1f82136028f85030fffcdab26c8d1a9d3333d /org.eclipse.jgit
parentf71fcbf36b9f9e21f8b796a0b2ea8226818e4780 (diff)
downloadjgit-eb5124c74f9bcdedc8492a8c1eddc734adfb7226.tar.gz
jgit-eb5124c74f9bcdedc8492a8c1eddc734adfb7226.zip
AutoCRLFOutputStream: use BufferedOutputStream
This should improve performance of autocrlf checkout. Bug: 580651 Change-Id: I2e2fe0273ac3c71fad50a575278234804ee28306
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/io/AutoCRLFOutputStream.java5
1 files changed, 4 insertions, 1 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 e638b2de3a..305ccbd7e6 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
@@ -10,6 +10,7 @@
package org.eclipse.jgit.util.io;
+import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -58,7 +59,9 @@ public class AutoCRLFOutputStream extends OutputStream {
* @since 4.3
*/
public AutoCRLFOutputStream(OutputStream out, boolean detectBinary) {
- this.out = out;
+ // avoid to write single lines directly to FileOutputStream:
+ this.out = out instanceof BufferedOutputStream ? out
+ : new BufferedOutputStream(out);
this.detectBinary = detectBinary;
}