From eb5124c74f9bcdedc8492a8c1eddc734adfb7226 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rg=20Kubitz?= Date: Wed, 31 Aug 2022 17:02:54 +0200 Subject: [PATCH] AutoCRLFOutputStream: use BufferedOutputStream This should improve performance of autocrlf checkout. Bug: 580651 Change-Id: I2e2fe0273ac3c71fad50a575278234804ee28306 --- .../src/org/eclipse/jgit/util/io/AutoCRLFOutputStream.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; } -- 2.39.5