Class Scanner
- java.lang.Object
-
- org.eclipse.jgit.internal.storage.reftree.Scanner
-
class Scanner extends java.lang.Object
A tree parser that extracts references from aRefTree
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
Scanner.Result
-
Field Summary
Fields Modifier and Type Field Description private static byte[]
BINARY_R_REFS
private static int
MAX_SYMLINK_BYTES
private static byte[]
REFS_DOT_DOT
-
Constructor Summary
Constructors Modifier Constructor Description private
Scanner()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static CanonicalTreeParser
createParserAtPath(ObjectReader reader, AnyObjectId srcId, java.lang.String prefix)
private static boolean
curElementHasPeelSuffix(AbstractTreeIterator itr)
private static void
peel(RefList.Builder<Ref> all, CanonicalTreeParser p)
private static java.lang.String
refName(CanonicalTreeParser p, boolean peel)
private static Ref
resolve(Ref ref, int depth, RefList<Ref> refs)
private static void
scan(ObjectReader reader, AnyObjectId srcId, java.lang.String prefix, boolean recursive, RefList.Builder<Ref> all, RefList.Builder<Ref> sym)
(package private) static Scanner.Result
scanRefTree(Repository repo, Ref src, java.lang.String prefix, boolean recursive)
private static Ref
toRef(ObjectReader reader, int mode, CanonicalTreeParser p)
private static RevTree
toTree(ObjectReader reader, AnyObjectId id)
-
-
-
Field Detail
-
MAX_SYMLINK_BYTES
private static final int MAX_SYMLINK_BYTES
- See Also:
- Constant Field Values
-
BINARY_R_REFS
private static final byte[] BINARY_R_REFS
-
REFS_DOT_DOT
private static final byte[] REFS_DOT_DOT
-
-
Method Detail
-
scanRefTree
static Scanner.Result scanRefTree(Repository repo, @Nullable Ref src, java.lang.String prefix, boolean recursive) throws java.io.IOException
- Parameters:
repo
- source repository containing the commit and tree objects that make up the RefTree.src
- bootstrap reference such asrefs/txn/committed
to read the reference tree tip from. The current ObjectId will be included inScanner.Result.refTreeId
.prefix
- if non-empty a reference prefix to scan only a subdirectory. For exampleprefix = "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 ofexactRef(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.
-
scan
private static void scan(ObjectReader reader, AnyObjectId srcId, java.lang.String prefix, boolean recursive, RefList.Builder<Ref> all, RefList.Builder<Ref> sym) throws IncorrectObjectTypeException, java.io.IOException
- Throws:
IncorrectObjectTypeException
java.io.IOException
-
createParserAtPath
private static CanonicalTreeParser createParserAtPath(ObjectReader reader, AnyObjectId srcId, java.lang.String prefix) throws java.io.IOException
- Throws:
java.io.IOException
-
resolve
private static Ref resolve(Ref ref, int depth, RefList<Ref> refs) throws java.io.IOException
- Throws:
java.io.IOException
-
toTree
private static RevTree toTree(ObjectReader reader, AnyObjectId id) throws java.io.IOException
- Throws:
java.io.IOException
-
curElementHasPeelSuffix
private static boolean curElementHasPeelSuffix(AbstractTreeIterator itr)
-
peel
private static void peel(RefList.Builder<Ref> all, CanonicalTreeParser p)
-
toRef
private static Ref toRef(ObjectReader reader, int mode, CanonicalTreeParser p) throws java.io.IOException
- Throws:
java.io.IOException
-
refName
private static java.lang.String refName(CanonicalTreeParser p, boolean peel)
-
-