summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-08-23 10:29:50 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-08-23 10:29:50 -0700
commitedd8029558483a56c850f1beb31f81f5e1288f09 (patch)
tree8c4fd94d19280f10efd41943b186d24aa3202f10 /org.eclipse.jgit
parent6df5d3397c5c9354409d21a8e207a061f2e6efc2 (diff)
downloadjgit-edd8029558483a56c850f1beb31f81f5e1288f09.tar.gz
jgit-edd8029558483a56c850f1beb31f81f5e1288f09.zip
Add setLength(long) to DirCacheEntry
Applications should favor the long style interface, especially when their source input is a long type, e.g. coming from java.io.File. This way when the index format is later changed to support a larger file size than 2 GiB we can handle it by just changing the entry code, and not need to fix a lot of applications. Change-Id: I332563caeb110014e2d544dc33050ce67ae9e897 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java16
3 files changed, 18 insertions, 0 deletions
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties
index 681d289c84..58adf332d3 100644
--- a/org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties
+++ b/org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties
@@ -328,6 +328,7 @@ shortReadOfBlock=Short read of block.
shortReadOfOptionalDIRCExtensionExpectedAnotherBytes=Short read of optional DIRC extension {0}; expected another {1} bytes within the section.
shortSkipOfBlock=Short skip of block.
similarityScoreMustBeWithinBounds=Similarity score must be between 0 and 100.
+sizeExceeds2GB=Path {0} size {1} exceeds 2 GiB limit.
smartHTTPPushDisabled=smart HTTP push disabled
sourceDestinationMustMatch=Source/Destination must match.
sourceIsNotAWildcard=Source is not a wildcard.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java
index 193d733679..f7eea3fe9f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java
@@ -387,6 +387,7 @@ public class JGitText extends TranslationBundle {
/***/ public String shortReadOfOptionalDIRCExtensionExpectedAnotherBytes;
/***/ public String shortSkipOfBlock;
/***/ public String similarityScoreMustBeWithinBounds;
+ /***/ public String sizeExceeds2GB;
/***/ public String smartHTTPPushDisabled;
/***/ public String sourceDestinationMustMatch;
/***/ public String sourceIsNotAWildcard;
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 909729d6c6..b7fc1c787d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
@@ -487,6 +487,22 @@ public class DirCacheEntry {
}
/**
+ * Set the cached size (in bytes) of this file.
+ *
+ * @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.
+ */
+ public void setLength(final long sz) {
+ if (Integer.MAX_VALUE <= sz)
+ throw new IllegalArgumentException(MessageFormat.format(JGitText
+ .get().sizeExceeds2GB, getPathString(), sz));
+ setLength((int) sz);
+ }
+
+ /**
* Obtain the ObjectId for the entry.
* <p>
* Using this method to compare ObjectId values between entries is