Class DirCacheIterator

  • Direct Known Subclasses:
    DirCacheBuildIterator

    public class DirCacheIterator
    extends AbstractTreeIterator
    Iterate a DirCache as part of a TreeWalk.

    This is an iterator to adapt a loaded DirCache instance (such as read from an existing .git/index file) to the tree structure used by a TreeWalk, making it possible for applications to walk over any combination of tree objects already in the object database, index files, or working directories.

    See Also:
    TreeWalk
    • Field Detail

      • cache

        protected final DirCache cache
        The cache this iterator was created to walk.
      • ptr

        protected int ptr
        Index of entry within cache.
    • Constructor Detail

      • DirCacheIterator

        public DirCacheIterator​(DirCache dc)
        Create a new iterator for an already loaded DirCache instance.

        The iterator implementation may copy part of the cache's data during construction, so the cache must be read in prior to creating the iterator.

        Parameters:
        dc - the cache to walk. It must be already loaded into memory.