Class Scanner


  • class Scanner
    extends java.lang.Object
    A tree parser that extracts references from a RefTree.
    • Field Detail

      • BINARY_R_REFS

        private static final byte[] BINARY_R_REFS
      • REFS_DOT_DOT

        private static final byte[] REFS_DOT_DOT
    • Constructor Detail

      • Scanner

        private Scanner()
    • Method Detail

      • scanRefTree

        static Scanner.Result scanRefTree​(Repository repo,
                                          @Nullable
                                          Ref src,
                                          java.lang.String prefix,
                                          boolean recursive)
                                   throws java.io.IOException
        Scan a RefTree and parse entries into Ref instances.
        Parameters:
        repo - source repository containing the commit and tree objects that make up the RefTree.
        src - bootstrap reference such as refs/txn/committed to read the reference tree tip from. The current ObjectId will be included in Scanner.Result.refTreeId.
        prefix - if non-empty a reference prefix to scan only a subdirectory. For example prefix = "refs/heads/" will limit the scan to only the "heads" directory of the RefTree, avoiding other directories like "tags". Empty string reads all entries in the RefTree.
        recursive - if true recurse into subdirectories of the reference tree; false to read only one level. Callers may use false during an implementation of exactRef(String) where only one reference is needed out of a specific subtree.
        Returns:
        sorted list of references after parsing.
        Throws:
        java.io.IOException - tree cannot be accessed from the repository.
      • resolve

        private static Ref resolve​(Ref ref,
                                   int depth,
                                   RefList<Ref> refs)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • curElementHasPeelSuffix

        private static boolean curElementHasPeelSuffix​(AbstractTreeIterator itr)