Deprecate checkoutEntry without ObjectReader
Callers should manage the ObjectReader, as this allows the JGit library to cache context relevant information across files checked out at the same time. If the caller only has one file to checkout, it should still explicitly manage the life span of the ObjectReader. Change-Id: Ib57fba6cb4b774ccff8c416ef4d32e2b390f16a9
This commit is contained in:
parent
d81529029a
commit
3bc5188900
|
@ -291,13 +291,13 @@ public void testIsModifiedSymlinkAsFile() throws Exception {
|
||||||
// Modify previously committed DirCacheEntry and write it back to disk
|
// Modify previously committed DirCacheEntry and write it back to disk
|
||||||
DirCacheEntry dce = db.readDirCache().getEntry("symlink");
|
DirCacheEntry dce = db.readDirCache().getEntry("symlink");
|
||||||
dce.setFileMode(FileMode.SYMLINK);
|
dce.setFileMode(FileMode.SYMLINK);
|
||||||
DirCacheCheckout.checkoutEntry(db, f, dce);
|
ObjectReader objectReader = db.newObjectReader();
|
||||||
|
DirCacheCheckout.checkoutEntry(db, f, dce, objectReader);
|
||||||
|
|
||||||
FileTreeIterator fti = new FileTreeIterator(trash, db.getFS(), db
|
FileTreeIterator fti = new FileTreeIterator(trash, db.getFS(), db
|
||||||
.getConfig().get(WorkingTreeOptions.KEY));
|
.getConfig().get(WorkingTreeOptions.KEY));
|
||||||
while (!fti.getEntryPathString().equals("symlink"))
|
while (!fti.getEntryPathString().equals("symlink"))
|
||||||
fti.next(1);
|
fti.next(1);
|
||||||
ObjectReader objectReader = db.newObjectReader();
|
|
||||||
assertFalse(fti.isModified(dce, false, objectReader));
|
assertFalse(fti.isModified(dce, false, objectReader));
|
||||||
objectReader.release();
|
objectReader.release();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1163,7 +1163,9 @@ private boolean isModifiedSubtree_IndexTree(String path, ObjectId tree)
|
||||||
* @param entry
|
* @param entry
|
||||||
* the entry containing new mode and content
|
* the entry containing new mode and content
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
|
* @deprecated Use the overloaded form that accepts {@link ObjectReader}.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static void checkoutEntry(final Repository repository, File f,
|
public static void checkoutEntry(final Repository repository, File f,
|
||||||
DirCacheEntry entry) throws IOException {
|
DirCacheEntry entry) throws IOException {
|
||||||
ObjectReader or = repository.newObjectReader();
|
ObjectReader or = repository.newObjectReader();
|
||||||
|
|
Loading…
Reference in New Issue