Package org.eclipse.jgit.http.test
Class RefsUnreadableInMemoryRepository.RefsUnreadableRefDatabase
java.lang.Object
org.eclipse.jgit.lib.RefDatabase
org.eclipse.jgit.internal.storage.dfs.DfsRefDatabase
org.eclipse.jgit.internal.storage.dfs.DfsReftableDatabase
org.eclipse.jgit.internal.storage.dfs.InMemoryRepository.MemRefDatabase
org.eclipse.jgit.http.test.RefsUnreadableInMemoryRepository.RefsUnreadableRefDatabase
- Enclosing class:
RefsUnreadableInMemoryRepository
private class RefsUnreadableInMemoryRepository.RefsUnreadableRefDatabase
extends InMemoryRepository.MemRefDatabase
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jgit.internal.storage.dfs.DfsRefDatabase
DfsRefDatabase.RefCache
-
Field Summary
Fields inherited from class org.eclipse.jgit.lib.RefDatabase
ALL, MAX_SYMBOLIC_REF_DEPTH, SEARCH_PATH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRead a single reference.Get a section of the reference namespace.getRefsByPrefix
(String prefix) Returns refs whose names start with a given prefix.getRefsByPrefixWithExclusions
(String include, Set<String> excludes) Returns refs whose names start with a given prefix excluding all refs that start with one of the given prefixes.Returns all refs that resolve directly to the givenObjectId
.Methods inherited from class org.eclipse.jgit.internal.storage.dfs.InMemoryRepository.MemRefDatabase
getReftableConfig, performsAtomicTransactions
Methods inherited from class org.eclipse.jgit.internal.storage.dfs.DfsReftableDatabase
cachePeeledState, compactDuringCommit, compareAndPut, compareAndRemove, getLock, hasFastTipsWithSha1, hasVersioning, isNameConflicting, newBatchUpdate, peel, scanAllRefs, stack
Methods inherited from class org.eclipse.jgit.internal.storage.dfs.DfsRefDatabase
close, create, getAdditionalRefs, getRepository, newRename, newUpdate, refresh
Methods inherited from class org.eclipse.jgit.lib.RefDatabase
exactRef, findRef, findRef, firstExactRef, getConflictingNames, getRef, getRefs, getRefsByPrefix, hasRefs
-
Constructor Details
-
RefsUnreadableRefDatabase
private RefsUnreadableRefDatabase()
-
-
Method Details
-
exactRef
Read a single reference.Unlike
RefDatabase.findRef(java.lang.String)
, this method expects an unshortened reference name and does not search using the standardRefDatabase.SEARCH_PATH
.- Overrides:
exactRef
in classDfsReftableDatabase
- Parameters:
name
- the unabbreviated name of the reference.- Returns:
- the reference (if it exists); else
null
. - Throws:
IOException
- the reference space cannot be accessed.
-
getRefs
Get a section of the reference namespace.- Overrides:
getRefs
in classDfsReftableDatabase
- Parameters:
prefix
- prefix to search the namespace with; must end with/
. If the empty string (RefDatabase.ALL
), obtain a complete snapshot of all references.- Returns:
- modifiable map that is a complete snapshot of the current
reference namespace, with
prefix
removed from the start of each key. The map can be an unsorted map. - Throws:
IOException
- the reference space cannot be accessed.
-
getRefsByPrefix
Returns refs whose names start with a given prefix.The default implementation uses
RefDatabase.getRefs(String)
. Implementors ofRefDatabase
should override this method directly if a better implementation is possible.- Overrides:
getRefsByPrefix
in classDfsReftableDatabase
- Parameters:
prefix
- string that names of refs should start with; may be empty (to return all refs).- Returns:
- immutable list of refs whose names start with
prefix
. - Throws:
IOException
- the reference space cannot be accessed.
-
getRefsByPrefixWithExclusions
public List<Ref> getRefsByPrefixWithExclusions(String include, Set<String> excludes) throws IOException Returns refs whose names start with a given prefix excluding all refs that start with one of the given prefixes.The default implementation is not efficient. Implementors of
RefDatabase
should override this method directly if a better implementation is possible.- Overrides:
getRefsByPrefixWithExclusions
in classDfsReftableDatabase
- Parameters:
include
- string that names of refs should start with; may be empty.excludes
- strings that names of refs can't start with; may be empty.- Returns:
- immutable list of refs whose names start with
prefix
and none of the strings inexclude
. - Throws:
IOException
- the reference space cannot be accessed.
-
getTipsWithSha1
Returns all refs that resolve directly to the givenObjectId
. Includes peeledObjectId
s. This is the inverse lookup ofRefDatabase.exactRef(String...)
.The default implementation uses a linear scan. Implementors of
RefDatabase
should override this method directly if a better implementation is possible.- Overrides:
getTipsWithSha1
in classDfsReftableDatabase
- Parameters:
id
-ObjectId
to resolve- Returns:
- a
Set
ofRef
s whose tips point to the provided id. - Throws:
IOException
- the reference space cannot be accessed.
-