aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2010-12-04 03:49:11 -0500
committerCode Review <codereview-daemon@eclipse.org>2010-12-04 03:49:11 -0500
commit40c2f68382184568ddcb568e201dd6fdcafba784 (patch)
treead15c7a38473dc1306ad13fdbec59448c808b37f /org.eclipse.jgit
parent6ca9fd2d95432f535ac21ea0812cf83a6fa3863a (diff)
parent61db0e4787b2f330816d15fe173d7784fae02c60 (diff)
downloadjgit-40c2f68382184568ddcb568e201dd6fdcafba784.tar.gz
jgit-40c2f68382184568ddcb568e201dd6fdcafba784.zip
Merge "Fix checking out large files"
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java17
1 files changed, 2 insertions, 15 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
index 07f97d9b68..e4d5b76988 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
@@ -45,8 +45,6 @@ package org.eclipse.jgit.dircache;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
@@ -59,7 +57,6 @@ import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.IndexWriteException;
import org.eclipse.jgit.errors.MissingObjectException;
-import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectLoader;
@@ -836,21 +833,11 @@ public class DirCacheCheckout {
public static void checkoutEntry(final Repository repo, File f, DirCacheEntry entry,
boolean config_filemode) throws IOException {
ObjectLoader ol = repo.open(entry.getObjectId());
- if (ol == null)
- throw new MissingObjectException(entry.getObjectId(),
- Constants.TYPE_BLOB);
-
- byte[] bytes = ol.getCachedBytes();
-
File parentDir = f.getParentFile();
File tmpFile = File.createTempFile("._" + f.getName(), null, parentDir);
- FileChannel channel = new FileOutputStream(tmpFile).getChannel();
- ByteBuffer buffer = ByteBuffer.wrap(bytes);
+ FileOutputStream channel = new FileOutputStream(tmpFile);
try {
- int j = channel.write(buffer);
- if (j != bytes.length)
- throw new IOException(MessageFormat.format(
- JGitText.get().couldNotWriteFile, tmpFile));
+ ol.copyTo(channel);
} finally {
channel.close();
}