|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jgit.lib.Repository
org.eclipse.jgit.storage.file.FileRepository
public class FileRepository
Represents a Git repository. A repository holds all objects and refs used for managing source code (could by any type of file, but source code is what SCM's are typically used for). In Git terms all data is stored in GIT_DIR, typically a directory called .git. A work tree is maintained unless the repository is a bare repository. Typically the .git directory is located at the root of the work dir.
This class is thread-safe.
This implementation only handles a subtly undocumented subset of git features.
Constructor Summary | |
---|---|
FileRepository(BaseRepositoryBuilder options)
Create a repository using the local file system. |
|
FileRepository(File gitDir)
Construct a representation of a Git repository. |
|
FileRepository(String gitDir)
A convenience API for FileRepository(File) . |
Method Summary | |
---|---|
void |
create(boolean bare)
Create a new Git repository initializing the necessary files and directories. |
Set<ObjectId> |
getAdditionalHaves()
Objects known to exist but not expressed by Repository.getAllRefs() . |
FileBasedConfig |
getConfig()
|
ObjectDirectory |
getObjectDatabase()
|
File |
getObjectsDirectory()
|
RefDatabase |
getRefDatabase()
|
ReflogReader |
getReflogReader(String refName)
|
void |
notifyIndexChanged()
Notify that the index changed |
void |
openPack(File pack)
Add a single existing pack to the list of available pack files. |
void |
scanForRepoChanges()
Force a scan for changed refs. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FileRepository(File gitDir) throws IOException
The work tree, object directory, alternate object directories and index
file locations are deduced from the given git directory and the default
rules by running FileRepositoryBuilder
. This constructor is the
same as saying:
new FileRepositoryBuilder().setGitDir(gitDir).build()
gitDir
- GIT_DIR (the location of the repository metadata).
IOException
- the repository appears to already exist but cannot be
accessed.FileRepositoryBuilder
public FileRepository(String gitDir) throws IOException
FileRepository(File)
.
gitDir
- GIT_DIR (the location of the repository metadata).
IOException
- the repository appears to already exist but cannot be
accessed.FileRepositoryBuilder
public FileRepository(BaseRepositoryBuilder options) throws IOException
options
- description of the repository's important paths.
IOException
- the user configuration file or repository configuration file
cannot be accessed.Method Detail |
---|
public void create(boolean bare) throws IOException
create
in class Repository
bare
- if true, a bare repository is created.
IOException
- in case of IO problempublic File getObjectsDirectory()
public ObjectDirectory getObjectDatabase()
getObjectDatabase
in class Repository
public RefDatabase getRefDatabase()
getRefDatabase
in class Repository
public FileBasedConfig getConfig()
getConfig
in class Repository
public Set<ObjectId> getAdditionalHaves()
Repository.getAllRefs()
.
When a repository borrows objects from another repository, it can advertise that it safely has that other repository's references, without exposing any other details about the other repository. This may help a client trying to push changes avoid pushing more than it needs to.
getAdditionalHaves
in class Repository
public void openPack(File pack) throws IOException
pack
- path of the pack file to open.
IOException
- index file could not be opened, read, or is not recognized as
a Git pack file index.public void scanForRepoChanges() throws IOException
Repository
scanForRepoChanges
in class Repository
IOException
public void notifyIndexChanged()
Repository
notifyIndexChanged
in class Repository
public ReflogReader getReflogReader(String refName) throws IOException
getReflogReader
in class Repository
refName
-
ReflogReader
for the supplied refname, or null if the
named ref does not exist.
IOException
- the ref could not be accessed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |