diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2012-04-17 00:18:10 +0200 |
---|---|---|
committer | Robin Rosenberg <robin.rosenberg@dewire.com> | 2012-04-18 21:59:15 +0200 |
commit | 9c5b31703f278c510bec64fa7a822713feaca6f2 (patch) | |
tree | c044463db89ba26b780b6f002975aea6d841acac /org.eclipse.jgit | |
parent | a2dac2c78d1fff0b2cedadcdaac030001eb851ac (diff) | |
download | jgit-9c5b31703f278c510bec64fa7a822713feaca6f2.tar.gz jgit-9c5b31703f278c510bec64fa7a822713feaca6f2.zip |
Enable large file support
Allow adding files with size over 2 GB. The drawback is that the tests
for huge file support adds roughly 10 minutes of execution time.
For that reason we @Ignore the test in the standard test execution.
Change-Id: I5788e8009899203b346f353297166825b3744575
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java | 15 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java | 2 |
2 files changed, 8 insertions, 9 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java index 85df340d37..08cc9a8d52 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java @@ -525,7 +525,7 @@ public class DirCacheEntry { } /** - * Get the cached size (in bytes) of this file. + * Get the cached size (mod 4 GB) (in bytes) of this file. * <p> * One of the indicators that the file has been modified by an application * changing the working tree is if the size of the file (in bytes) differs @@ -534,6 +534,10 @@ public class DirCacheEntry { * Note that this is the length of the file in the working directory, which * may differ from the size of the decompressed blob if work tree filters * are being used, such as LF<->CRLF conversion. + * <p> + * Note also that for very large files, this is the size of the on-disk file + * truncated to 32 bits, i.e. modulo 4294967296. If that value is larger + * than 2GB, it will appear negative. * * @return cached size of the working directory file, in bytes. */ @@ -545,7 +549,8 @@ public class DirCacheEntry { * Set the cached size (in bytes) of this file. * * @param sz - * new cached size of the file, as bytes. + * new cached size of the file, as bytes. If the file is larger + * than 2G, cast it to (int) before calling this method. */ public void setLength(final int sz) { NB.encodeInt32(info, infoOffset + P_SIZE, sz); @@ -556,15 +561,9 @@ public class DirCacheEntry { * * @param sz * new cached size of the file, as bytes. - * @throws IllegalArgumentException - * if the size exceeds the 2 GiB barrier imposed by current file - * format limitations. */ @SuppressWarnings("boxing") public void setLength(final long sz) { - if (Integer.MAX_VALUE <= sz) - throw new IllegalArgumentException(MessageFormat.format(JGitText - .get().sizeExceeds2GB, getPathString(), sz)); setLength((int) sz); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java index 027101bf88..54eaeb9dfb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java @@ -711,7 +711,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { if (entry.isUpdateNeeded()) return MetadataDiff.DIFFER_BY_METADATA; - if (!entry.isSmudged() && (getEntryLength() != entry.getLength())) + if (!entry.isSmudged() && entry.getLength() != (int) getEntryLength()) return MetadataDiff.DIFFER_BY_METADATA; // Determine difference in mode-bits of file and index-entry. In the |