Class FileRepositoryBuilder
- java.lang.Object
-
- org.eclipse.jgit.lib.BaseRepositoryBuilder<FileRepositoryBuilder,Repository>
-
- org.eclipse.jgit.storage.file.FileRepositoryBuilder
-
public class FileRepositoryBuilder extends BaseRepositoryBuilder<FileRepositoryBuilder,Repository>
Constructs aFileRepository
.Applications must set one of
BaseRepositoryBuilder.setGitDir(File)
orBaseRepositoryBuilder.setWorkTree(File)
, or useBaseRepositoryBuilder.readEnvironment()
orBaseRepositoryBuilder.findGitDir()
in order to configure the minimum property set necessary to open a repository.Single repository applications trying to be compatible with other Git implementations are encouraged to use a model such as:
new FileRepositoryBuilder() // .setGitDir(gitDirArgument) // --git-dir if supplied, no-op if null .readEnvironment() // scan environment GIT_* variables .findGitDir() // scan up the file system tree .build()
-
-
Constructor Summary
Constructors Constructor Description FileRepositoryBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Repository
build()
Create a repository matching the configuration in this builder.static Repository
create(File gitDir)
Convenience factory method to construct aFileRepository
.-
Methods inherited from class org.eclipse.jgit.lib.BaseRepositoryBuilder
addAlternateObjectDirectories, addAlternateObjectDirectories, addAlternateObjectDirectory, addCeilingDirectories, addCeilingDirectories, addCeilingDirectory, findGitDir, findGitDir, getAlternateObjectDirectories, getConfig, getFS, getGitDir, getIndexFile, getInitialBranch, getObjectDirectory, getWorkTree, isBare, isMustExist, loadConfig, readEnvironment, readEnvironment, requireGitDirOrWorkTree, safeFS, self, setBare, setFS, setGitDir, setIndexFile, setInitialBranch, setMustExist, setObjectDirectory, setup, setupGitDir, setupInternals, setupWorkTree, setWorkTree
-
-
-
-
Method Detail
-
build
public Repository build() throws IOException
Create a repository matching the configuration in this builder.If an option was not set, the build method will try to default the option based on other options. If insufficient information is available, an exception is thrown to the caller.
Create a repository matching the configuration in this builder.
If an option was not set, the build method will try to default the option based on other options. If insufficient information is available, an exception is thrown to the caller.
- Overrides:
build
in classBaseRepositoryBuilder<FileRepositoryBuilder,Repository>
- Returns:
- a repository matching this configuration. The caller is responsible to close the repository instance when it is no longer needed.
- Throws:
IOException
- the repository could not be accessed to configure the rest of the builder's parameters.- Since:
- 3.0
-
create
public static Repository create(File gitDir) throws IOException
Convenience factory method to construct aFileRepository
.- Parameters:
gitDir
-GIT_DIR
, the repository meta directory.- Returns:
- a repository matching this configuration.
- Throws:
IOException
- the repository could not be accessed to configure the rest of the builder's parameters.- Since:
- 3.0
-
-