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 Modifier Constructor Description private
RefsUnreadableRefDatabase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Ref
exactRef(java.lang.String name)
Read a single reference.java.util.Map<java.lang.String,Ref>
getRefs(java.lang.String prefix)
Get a section of the reference namespace.java.util.List<Ref>
getRefsByPrefix(java.lang.String prefix)
Returns refs whose names start with a given prefix.java.util.List<Ref>
getRefsByPrefixWithExclusions(java.lang.String include, java.util.Set<java.lang.String> excludes)
Returns refs whose names start with a given prefix excluding all refs that start with one of the given prefixes.java.util.Set<Ref>
getTipsWithSha1(ObjectId id)
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
-
-
-
-
Method Detail
-
exactRef
public Ref exactRef(java.lang.String name) throws java.io.IOException
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:
java.io.IOException
- the reference space cannot be accessed.
-
getRefs
public java.util.Map<java.lang.String,Ref> getRefs(java.lang.String prefix) throws java.io.IOException
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:
java.io.IOException
- the reference space cannot be accessed.
-
getRefsByPrefix
public java.util.List<Ref> getRefsByPrefix(java.lang.String prefix) throws java.io.IOException
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:
java.io.IOException
- the reference space cannot be accessed.
-
getRefsByPrefixWithExclusions
public java.util.List<Ref> getRefsByPrefixWithExclusions(java.lang.String include, java.util.Set<java.lang.String> excludes) throws java.io.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:
java.io.IOException
- the reference space cannot be accessed.
-
getTipsWithSha1
public java.util.Set<Ref> getTipsWithSha1(ObjectId id) throws java.io.IOException
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:
java.io.IOException
- the reference space cannot be accessed.
-
-