diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/BinaryPatchWriter.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/BinaryPatchWriter.java index 9a8f14e7c717..cbf608b299ab 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/BinaryPatchWriter.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/BinaryPatchWriter.java @@ -25,7 +25,10 @@ import com.intellij.util.ArrayUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.io.*; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.Writer; import java.util.List; import static com.intellij.openapi.vcs.changes.patch.BlobIndexUtil.NOT_COMMITTED_HASH; @@ -72,8 +75,7 @@ public class BinaryPatchWriter { writer.write(String.format(LITERAL_HEADER, afterContent == null ? 0 : afterContent.length)); writer.write(lineSeparator); try { - BinaryEncoder - .encode(afterFile.exists() ? new FileInputStream(afterFile) : new ByteArrayInputStream(ArrayUtil.EMPTY_BYTE_ARRAY), writer); + BinaryEncoder.encode(new ByteArrayInputStream(afterContent != null ? afterContent : ArrayUtil.EMPTY_BYTE_ARRAY), writer); } catch (BinaryEncoder.BinaryPatchException e) { LOG.error("Can't write patch for binary file: " + afterFile.getPath(), e);