A reader that has been released can be used again, but may need to be released after the subsequent usage.
128129130131132133134135136137
assertEquals(aSlashCSlashD.getObjectId(), TreeWalk.forPath(or, "a/c/d", tree).getObjectId(0)); assertEquals(aSlashCSlashD.getObjectId(), TreeWalk .forPath(or, "c/d", a).getObjectId(0)); or.release(); oi.release(); } }
250251252253254255256257258259260
} catch (JGitInternalException e) { throw e; } catch (IOException e) { throw new JGitInternalException(JGitText.get().stashApplyFailed, e); } finally { reader.release(); } } /** * @param applyIndex
464465466467468469470471472473474
// commit the index builder - a new index is persisted if (!builder.commit()) throw new IndexWriteException(); } finally { objectReader.release(); } return toBeDeleted.size() == 0; } private static boolean isSamePrefix(String a, String b) {
11681169117011711172117311741175117611771178
DirCacheEntry entry) throws IOException { ObjectReader or = repository.newObjectReader(); try { checkoutEntry(repository, f, entry, repository.newObjectReader()); } finally { or.release(); } } /** * Updates the file in the working tree with content and mode from an entry
210211212213214215216217218219220
final Ref ref = e.getValue(); printHead(reader, e.getKey(), current.equals(ref.getName()), ref); } } finally { reader.release(); } } } private void addRefs(final Collection<Ref> refs, final String prefix) {
217218219220221222223224225226227
byte[] result; try { ObjectId oid = repo.resolve(ref + ":" + path); //$NON-NLS-1$ result = reader.open(oid).getBytes(Integer.MAX_VALUE); } finally { reader.release(); } return result; } }
186187188189190191192193194195196
CanonicalTreeParser p = new CanonicalTreeParser(); ObjectReader reader = db.newObjectReader(); try { p.reset(reader, head); } finally { reader.release(); } oldTree = p; } newTree = new DirCacheIterator(db.readDirCache()); } else if (oldTree == null) {
126127128129130131132133134135136
CanonicalTreeParser p = new CanonicalTreeParser(); ObjectReader reader = repo.newObjectReader(); try { p.reset(reader, head); } finally { reader.release(); } oldTree = p; } newTree = new DirCacheIterator(repo.readDirCache()); } else {
159160161162163164165166167168169
IncorrectObjectTypeException, CorruptObjectException, IOException { ObjectReader reader = db.newObjectReader(); try { return forPath(reader, path, trees); } finally { reader.release(); } } /** * Open a tree walk and filter to exactly one path.
231232233234235236237238239240241
} if (count > 0 && files > count) break; } } finally { or.release(); } Collections.sort(all, new Comparator<Test>() { public int compare(Test a, Test b) { int cmp = Long.signum(a.runningTimeNanos - b.runningTimeNanos);