/** {@inheritDoc} */ @Override public AbstractTreeIterator createSubtreeIterator(ObjectReader reader) throws IncorrectObjectTypeException, IOException { if (currentSubtree == null) throw new IncorrectObjectTypeException(getEntryObjectId(), Constants.TYPE_TREE); return new DirCacheIterator(this, currentSubtree); }
/** * Create a generator to walk over the submodule entries currently in the * index * * The {@code .gitmodules} file is read from the index. * * @param repository * a {@link org.eclipse.jgit.lib.Repository} object. * @return generator over submodule index entries. The caller is responsible * for calling {@link #close()}. * @throws java.io.IOException */ public static SubmoduleWalk forIndex(Repository repository) throws IOException { @SuppressWarnings("resource") // The caller closes it SubmoduleWalk generator = new SubmoduleWalk(repository); try { DirCache index = repository.readDirCache(); generator.setTree(new DirCacheIterator(index)); } catch (IOException e) { generator.close(); throw e; } return generator; }
treeWalk.addTree(new DirCacheIterator(repo.readDirCache())); ObjectId headID = repo.resolve(Constants.HEAD); if (headID != null) {
private void checkoutPathsFromIndex(TreeWalk treeWalk, DirCache dc) throws IOException { DirCacheIterator dci = new DirCacheIterator(dc); treeWalk.addTree(dci);
else treeWalk.addTree(new EmptyTreeIterator()); treeWalk.addTree(new DirCacheIterator(dirCache)); treeWalk.addTree(initialWorkingTreeIterator); initialWorkingTreeIterator.setDirCacheIterator(treeWalk, 1);
walk.setFilter(PathFilterGroup.createFromStrings(paths)); DirCacheIterator iIter = new DirCacheIterator(this); FileTreeIterator fIter = new FileTreeIterator(repository); walk.addTree(iIter);
newTree = new DirCacheIterator(repo.readDirCache()); } else { if (oldTree == null) oldTree = new DirCacheIterator(repo.readDirCache()); if (newTree == null) newTree = new FileTreeIterator(repo);
throws CorruptObjectException, IOException { try (NameConflictTreeWalk tw = new NameConflictTreeWalk(repo)) { int dciPos = tw.addTree(new DirCacheIterator(dc)); FileTreeIterator fti = new FileTreeIterator(repo); tw.addTree(fti);
public void checkout(DirCache cache) throws IOException { checkout(new DirCacheIterator(cache)); }
throws CorruptObjectException, IOException { try (NameConflictTreeWalk tw = new NameConflictTreeWalk(repo)) { tw.addTree(new DirCacheIterator(dc)); tw.addTree(tree); tw.setRecursive(true);
public void checkout(DirCache cache) throws IOException { checkout(new DirCacheIterator(cache)); }
treeWalk.addTree(new DirCacheIterator(cache)); treeWalk.addTree(new FileTreeIterator(repo)); treeWalk.getTree(2, FileTreeIterator.class)
treeWalk.reset(); treeWalk.setRecursive(true); treeWalk.addTree(new DirCacheIterator(dc)); ObjectId id = repo.resolve(Constants.HEAD + "^{tree}"); //$NON-NLS-1$ if (id == null)
@Override public AbstractTreeIterator createSubtreeIterator(final ObjectReader reader) throws IncorrectObjectTypeException, IOException { if (currentSubtree == null) throw new IncorrectObjectTypeException(getEntryObjectId(), Constants.TYPE_TREE); return new DirCacheIterator(this, currentSubtree); }
/** {@inheritDoc} */ @Override public AbstractTreeIterator createSubtreeIterator(ObjectReader reader) throws IncorrectObjectTypeException, IOException { if (currentSubtree == null) throw new IncorrectObjectTypeException(getEntryObjectId(), Constants.TYPE_TREE); return new DirCacheIterator(this, currentSubtree); }
walk.addTree(new DirCacheIterator(dc)); walk.setRecursive(true);
else walk.addTree(new EmptyTreeIterator()); walk.addTree(new DirCacheIterator(dc)); walk.setRecursive(true);
private AbstractTreeIterator getTreeIterator(Repository repo, String commit) throws IOException { if (commit.equals("dircache")) { return new DirCacheIterator(repo.readDirCache()); } if (commit.equals("filetree")) { return new FileTreeIterator(repo); } ObjectId treeId = repo.resolve(commit + "^{tree}"); if (treeId == null) { throw new NullPointerException(); } CanonicalTreeParser treeIter = new CanonicalTreeParser(); ObjectReader reader = repo.newObjectReader(); treeIter.reset(reader, treeId); return treeIter; }
private AbstractTreeIterator getTreeIterator(Repository repo, String commit) throws IOException { if (commit.equals("dircache")) { return new DirCacheIterator(repo.readDirCache()); } if (commit.equals("filetree")) { return new FileTreeIterator(repo); } ObjectId treeId = repo.resolve(commit + "^{tree}"); if (treeId == null) { throw new NullPointerException(); } CanonicalTreeParser treeIter = new CanonicalTreeParser(); ObjectReader reader = repo.newObjectReader(); treeIter.reset(reader, treeId); return treeIter; }
private boolean indexIsEmpty(DirCache dc) throws Exception { DirCacheIterator dci = new DirCacheIterator(dc); AbstractTreeIterator old = prepareTreeParser(repository, repository.resolve(Constants.HEAD)); try (Git git = new Git(repository)) { List<DiffEntry> diffs = git.diff().setOldTree(old).setNewTree(dci).call(); return diffs.isEmpty(); } }