aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/util/WorkTreeUpdater.java
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2022-08-25 19:37:35 +0200
committerHan-Wen Nienhuys <hanwen@google.com>2022-09-06 10:01:44 +0200
commit2778bb2cc9bf7bdfb2ed7b3a99dd931d6d3fbbfa (patch)
tree7bd70993307b3d1367aa30a736cb530704351ec6 /org.eclipse.jgit/src/org/eclipse/jgit/util/WorkTreeUpdater.java
parent25aceffdc58fdc5707c908fb4c3584116703046e (diff)
downloadjgit-2778bb2cc9bf7bdfb2ed7b3a99dd931d6d3fbbfa.tar.gz
jgit-2778bb2cc9bf7bdfb2ed7b3a99dd931d6d3fbbfa.zip
WorkTreeUpdater: remove safeWrite option
This was added in Ideaefd5178 to anticipate on writing files for ApplyCommand, but we are keeping WorkTreeUpdater private to the merge package for now. Change-Id: Ifa79dac245e60eb7a77eaea4cc1249222e347d38
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/util/WorkTreeUpdater.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/WorkTreeUpdater.java25
1 files changed, 2 insertions, 23 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/WorkTreeUpdater.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/WorkTreeUpdater.java
index e5de2b4a7d..d35efe3e35 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/WorkTreeUpdater.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/WorkTreeUpdater.java
@@ -18,8 +18,6 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.nio.file.Files;
-import java.nio.file.StandardCopyOption;
import java.time.Instant;
import java.util.HashMap;
import java.util.LinkedList;
@@ -611,37 +609,18 @@ public class WorkTreeUpdater implements Closeable {
* of the file to be updated
* @param file
* to be updated
- * @param safeWrite
- * whether the content should be written to a buffer first
* @throws IOException
* if the file cannot be updated
*/
public void updateFileWithContent(StreamLoader resultStreamLoader,
EolStreamType streamType, String smudgeCommand, String path,
- File file, boolean safeWrite) throws IOException {
+ File file) throws IOException {
if (inCore) {
return;
}
CheckoutMetadata metadata = new CheckoutMetadata(streamType,
smudgeCommand);
- if (safeWrite) {
- // Write to a buffer and copy to the file only if everything was
- // fine.
- TemporaryBuffer buffer = new TemporaryBuffer.LocalFile(null);
- try {
- try (TemporaryBuffer buf = buffer) {
- DirCacheCheckout.getContent(repo, path, metadata,
- resultStreamLoader, workingTreeOptions, buf);
- }
- try (InputStream bufIn = buffer.openInputStream()) {
- Files.copy(bufIn, file.toPath(),
- StandardCopyOption.REPLACE_EXISTING);
- }
- } finally {
- buffer.destroy();
- }
- return;
- }
+
try (OutputStream outputStream = new FileOutputStream(file)) {
DirCacheCheckout.getContent(repo, path, metadata,
resultStreamLoader, workingTreeOptions, outputStream);