diff options
author | Shawn Pearce <sop@google.com> | 2014-11-24 11:38:09 -0800 |
---|---|---|
committer | Shawn Pearce <sop@google.com> | 2014-11-24 12:59:45 -0800 |
commit | 3bc51889000bd9e3b52203ccdab5f0f77b7100ea (patch) | |
tree | e3a603b4d032b06ea236f89fffe1551598ff6a85 | |
parent | d81529029a887cbc2356d6fc8d0168bd2f031ca2 (diff) | |
download | jgit-3bc51889000bd9e3b52203ccdab5f0f77b7100ea.tar.gz jgit-3bc51889000bd9e3b52203ccdab5f0f77b7100ea.zip |
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
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java | 4 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java index ab4579009b..b3dc267b97 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java @@ -291,13 +291,13 @@ public class FileTreeIteratorTest extends RepositoryTestCase { // Modify previously committed DirCacheEntry and write it back to disk DirCacheEntry dce = db.readDirCache().getEntry("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 .getConfig().get(WorkingTreeOptions.KEY)); while (!fti.getEntryPathString().equals("symlink")) fti.next(1); - ObjectReader objectReader = db.newObjectReader(); assertFalse(fti.isModified(dce, false, objectReader)); objectReader.release(); } 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 9f340c1191..a9b36b0fbb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java @@ -1163,7 +1163,9 @@ public class DirCacheCheckout { * @param entry * the entry containing new mode and content * @throws IOException + * @deprecated Use the overloaded form that accepts {@link ObjectReader}. */ + @Deprecated public static void checkoutEntry(final Repository repository, File f, DirCacheEntry entry) throws IOException { ObjectReader or = repository.newObjectReader(); |