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>
This commit is contained in:
parent
6df5d3397c
commit
edd8029558
|
@ -328,6 +328,7 @@ shortReadOfBlock=Short read of block.
|
||||||
shortReadOfOptionalDIRCExtensionExpectedAnotherBytes=Short read of optional DIRC extension {0}; expected another {1} bytes within the section.
|
shortReadOfOptionalDIRCExtensionExpectedAnotherBytes=Short read of optional DIRC extension {0}; expected another {1} bytes within the section.
|
||||||
shortSkipOfBlock=Short skip of block.
|
shortSkipOfBlock=Short skip of block.
|
||||||
similarityScoreMustBeWithinBounds=Similarity score must be between 0 and 100.
|
similarityScoreMustBeWithinBounds=Similarity score must be between 0 and 100.
|
||||||
|
sizeExceeds2GB=Path {0} size {1} exceeds 2 GiB limit.
|
||||||
smartHTTPPushDisabled=smart HTTP push disabled
|
smartHTTPPushDisabled=smart HTTP push disabled
|
||||||
sourceDestinationMustMatch=Source/Destination must match.
|
sourceDestinationMustMatch=Source/Destination must match.
|
||||||
sourceIsNotAWildcard=Source is not a wildcard.
|
sourceIsNotAWildcard=Source is not a wildcard.
|
||||||
|
|
|
@ -387,6 +387,7 @@ public static JGitText get() {
|
||||||
/***/ public String shortReadOfOptionalDIRCExtensionExpectedAnotherBytes;
|
/***/ public String shortReadOfOptionalDIRCExtensionExpectedAnotherBytes;
|
||||||
/***/ public String shortSkipOfBlock;
|
/***/ public String shortSkipOfBlock;
|
||||||
/***/ public String similarityScoreMustBeWithinBounds;
|
/***/ public String similarityScoreMustBeWithinBounds;
|
||||||
|
/***/ public String sizeExceeds2GB;
|
||||||
/***/ public String smartHTTPPushDisabled;
|
/***/ public String smartHTTPPushDisabled;
|
||||||
/***/ public String sourceDestinationMustMatch;
|
/***/ public String sourceDestinationMustMatch;
|
||||||
/***/ public String sourceIsNotAWildcard;
|
/***/ public String sourceIsNotAWildcard;
|
||||||
|
|
|
@ -486,6 +486,22 @@ public void setLength(final int sz) {
|
||||||
NB.encodeInt32(info, infoOffset + P_SIZE, sz);
|
NB.encodeInt32(info, infoOffset + P_SIZE, sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* Obtain the ObjectId for the entry.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
Loading…
Reference in New Issue