Repository implementations may subclass this builder in order to add custom repository detection methods.
RepositoryBuilder, FileRepositoryBuilder
| Modifier and Type | Field and Description |
|---|---|
| private List | |
| private boolean | bare
True only if the caller wants to force bare behavior. |
| private List | ceilingDirectories
Directories limiting the search for a Git repository. |
| private Config | config
Configuration file of target repository, lazily loaded if required. |
| private FS | |
| private File | |
| private File | |
| private File | |
| private String | |
| private boolean | mustExist
True if the caller requires the repository to exist. |
| private File | |
| private File |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public B | Returns: this (for chaining calls).other object directories to search after the standard one. The
collection's contents is copied to an internal list. inList)Add alternate object directories to the search list. |
| public B | Returns: this (for chaining calls).other object directories to search after the standard one. The
array's contents is copied to an internal list. inList)Add alternate object directories to the search list. |
| public B | Returns: this (for chaining calls).another objects directory to search after the standard one. other)Add an alternate object directory to the search list. |
| public B | Returns: this (for chaining calls).directory paths to stop searching at. The collection's
contents is copied to an internal list. inList)Add ceiling directories to the search list. |
| public B | Returns: this (for chaining calls).directory paths to stop searching at. The array's contents is
copied to an internal list. inList)Add ceiling directories to the search list. |
| public B | Returns: this (for chaining calls).a path to stop searching at; its parent will not be searched. root)Add a ceiling directory to the search limit list. |
| public R | Returns: a repository matching this configuration. The caller is responsible to close the repository instance when it is no longer needed.Create a repository matching the configuration in this builder. |
| public B | |
| public B | Returns: this (for chaining calls).directory to begin searching in. current)Configure |
| public File[] | Returns: ordered array of alternate directories; null if non were set.Get ordered array of alternate directories; null if non were set. |
| protected Config | Returns: the configuration of the repository.Get the cached repository configuration, loading if not yet available. |
| public FS | Returns: the file system abstraction, or null if not set.Get the file system abstraction, or null if not set. |
| public File | |
| public File | Returns: the meta data directory; null if not set.Get the meta data directory; null if not set. |
| public File | Returns: the index file location, or null if not set.Get the index file location, or null if not set. |
| public String | Returns: the initial branch of the new repository.Get the initial branch of the new repository. |
| public File | Returns: the object directory; null if not set.Get the object directory; null if not set. |
| pack-priv static File | |
| public File | Returns: the work tree directory, or null if not set.Get the work tree directory, or null if not set. |
| private File | |
| public boolean | |
| public boolean | Returns: true if the repository must exist before being opened.Whether the repository must exist before being opened. |
| private static boolean | |
| protected Config | Returns: the repository's configuration.Parse and load the repository specific configuration. |
| public B | Returns: this (for chaining calls).Read standard Git environment variables and configure from those. |
| public B | Returns: this (for chaining calls).the SystemReader abstraction to access the environment. sr)Read standard Git environment variables and configure from those. |
| protected void | |
| protected FS | |
| protected final B | |
| public B | Returns: this (for chaining calls).Force the repository to be treated as bare (have no working directory). |
| public B | |
| public B | Returns: this (for chaining calls).GIT_COMMON_DIR, the common repository meta directory.Set common dir. |
| public B | |
| public B | Returns: this (for chaining calls).GIT_INDEX_FILE, the index file location.Set the local index file that is caching checked out file status. |
| public B | Returns: thisinitial branch name of the new repository. If branch)null or
empty the configured default branch will be used.Set the initial branch of the new repository. |
| public B | Returns: this (for chaining calls).true if it must exist; false if it can be missing and created
after being built. mustExist)Require the repository to exist before it can be opened. |
| public B | Returns: this (for chaining calls).GIT_OBJECT_DIRECTORY, the directory where the
repository's object files are stored.Set the directory storing the repository's objects. |
| public B | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| public B | Returns: this (for chaining calls).GIT_WORK_TREE, the working directory of the checkout.Set the top level directory of the working files. |
| alternateObjectDirectories | back to summary |
|---|---|
| private List<File> alternateObjectDirectories | |
| bare | back to summary |
|---|---|
| private boolean bare True only if the caller wants to force bare behavior. | |
| ceilingDirectories | back to summary |
|---|---|
| private List<File> ceilingDirectories Directories limiting the search for a Git repository. | |
| config | back to summary |
|---|---|
| private Config config Configuration file of target repository, lazily loaded if required. | |
| fs | back to summary |
|---|---|
| private FS fs | |
| gitCommonDir | back to summary |
|---|---|
| private File gitCommonDir | |
| gitDir | back to summary |
|---|---|
| private File gitDir | |
| indexFile | back to summary |
|---|---|
| private File indexFile | |
| initialBranch | back to summary |
|---|---|
| private String initialBranch | |
| mustExist | back to summary |
|---|---|
| private boolean mustExist True if the caller requires the repository to exist. | |
| objectDirectory | back to summary |
|---|---|
| private File objectDirectory | |
| workTree | back to summary |
|---|---|
| private File workTree | |
| BaseRepositoryBuilder | back to summary |
|---|---|
| public BaseRepositoryBuilder() | |
| addAlternateObjectDirectories | back to summary |
|---|---|
| public B addAlternateObjectDirectories(Collection<File> inList) Add alternate object directories to the search list.
This setting handles several alternate directories at once, and is
provided to support
| |
| addAlternateObjectDirectories | back to summary |
|---|---|
| public B addAlternateObjectDirectories(File[] inList) Add alternate object directories to the search list.
This setting handles several alternate directories at once, and is
provided to support
| |
| addAlternateObjectDirectory | back to summary |
|---|---|
| public B addAlternateObjectDirectory(File other) Add an alternate object directory to the search list.
This setting handles one alternate directory at a time, and is provided
to support
| |
| addCeilingDirectories | back to summary |
|---|---|
| public B addCeilingDirectories(Collection<File> inList) Add ceiling directories to the search list.
This setting handles several ceiling directories at once, and is provided
to support
| |
| addCeilingDirectories | back to summary |
|---|---|
| public B addCeilingDirectories(File[] inList) Add ceiling directories to the search list.
This setting handles several ceiling directories at once, and is provided
to support
| |
| addCeilingDirectory | back to summary |
|---|---|
| public B addCeilingDirectory(File root) Add a ceiling directory to the search limit list.
This setting handles one ceiling directory at a time, and is provided to
support
| |
| build | back to summary |
|---|---|
| public R 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.
| |
| findGitDir | back to summary |
|---|---|
| public B findGitDir() Configure
Starts from the current working directory of the JVM and scans up through
the directory tree until a Git repository is found. Success can be
determined by checking for
The search can be limited to specific spaces of the local filesystem by
| |
| findGitDir | back to summary |
|---|---|
| public B findGitDir(File current) Configure
Starts from the supplied directory path and scans up through the parent
directory tree until a Git repository is found. Success can be determined
by checking for
The search can be limited to specific spaces of the local filesystem by
| |
| getAlternateObjectDirectories | back to summary |
|---|---|
| public File[] getAlternateObjectDirectories() Get ordered array of alternate directories; null if non were set.
| |
| getConfig | back to summary |
|---|---|
| protected Config getConfig() throws IOException Get the cached repository configuration, loading if not yet available.
| |
| getFS | back to summary |
|---|---|
| public FS getFS() Get the file system abstraction, or null if not set.
| |
| getGitCommonDir | back to summary |
|---|---|
| public File getGitCommonDir() Get common dir.
| |
| getGitDir | back to summary |
|---|---|
| public File getGitDir() Get the meta data directory; null if not set.
| |
| getIndexFile | back to summary |
|---|---|
| public File getIndexFile() Get the index file location, or null if not set.
| |
| getInitialBranch | back to summary |
|---|---|
| public String getInitialBranch() Get the initial branch of the new repository. | |
| getObjectDirectory | back to summary |
|---|---|
| public File getObjectDirectory() Get the object directory; null if not set.
| |
| getSymRef | back to summary |
|---|---|
| pack-priv static File getSymRef(File workTree, File dotGit, FS fs) throws IOException Read symbolic reference file
| |
| getWorkTree | back to summary |
|---|---|
| public File getWorkTree() Get the work tree directory, or null if not set.
| |
| guessWorkTreeOrFail | back to summary |
|---|---|
| private File guessWorkTreeOrFail() throws IOException | |
| isBare | back to summary |
|---|---|
| public boolean isBare() Whether this repository was forced bare by
| |
| isMustExist | back to summary |
|---|---|
| public boolean isMustExist() Whether the repository must exist before being opened.
| |
| isSymRef | back to summary |
|---|---|
| private static boolean isSymRef(byte[] ref) | |
| loadConfig | back to summary |
|---|---|
| protected Config loadConfig() throws IOException Parse and load the repository specific configuration.
The default implementation reads
| |
| readEnvironment | back to summary |
|---|---|
| public B readEnvironment() Read standard Git environment variables and configure from those.
This method tries to read the standard Git environment variables, such as
| |
| readEnvironment | back to summary |
|---|---|
| public B readEnvironment(SystemReader sr) Read standard Git environment variables and configure from those.
This method tries to read the standard Git environment variables, such as
| |
| requireGitDirOrWorkTree | back to summary |
|---|---|
| protected void requireGitDirOrWorkTree() Require either | |
| safeFS | back to summary |
|---|---|
| protected FS safeFS() Get the configured FS, or
| |
| self | back to summary |
|---|---|
| protected final B self() Get this object
| |
| setBare | back to summary |
|---|---|
| public B setBare() Force the repository to be treated as bare (have no working directory). If bare the working directory aspects of the repository won't be configured, and will not be accessible.
| |
| setFS | back to summary |
|---|---|
| public B setFS(FS fs) Set the file system abstraction needed by this repository.
| |
| setGitCommonDir | back to summary |
|---|---|
| public B setGitCommonDir(File gitCommonDir) Set common dir.
| |
| setGitDir | back to summary |
|---|---|
| public B setGitDir(File gitDir) Set the Git directory storing the repository metadata.
The meta directory stores the objects, references, and meta files like
| |
| setIndexFile | back to summary |
|---|---|
| public B setIndexFile(File indexFile) Set the local index file that is caching checked out file status.
The location of the index file tracking the status information for each
checked out file in
| |
| setInitialBranch | back to summary |
|---|---|
| public B setInitialBranch(String branch) throws InvalidRefNameException Set the initial branch of the new repository. If not specified
(
| |
| setMustExist | back to summary |
|---|---|
| public B setMustExist(boolean mustExist) Require the repository to exist before it can be opened.
| |
| setObjectDirectory | back to summary |
|---|---|
| public B setObjectDirectory(File objectDirectory) Set the directory storing the repository's objects.
| |
| setup | back to summary |
|---|---|
| public B setup() throws IllegalArgumentException, IOException Guess and populate all parameters not already defined. If an option was not set, the setup method will try to default the option based on other options. If insufficient information is available, an exception is thrown to the caller.
| |
| setupCommonDir | back to summary |
|---|---|
| protected void setupCommonDir() throws IOException Perform standard common dir initialization.
| |
| setupGitDir | back to summary |
|---|---|
| protected void setupGitDir() throws IOException Perform standard gitDir initialization.
| |
| setupInternals | back to summary |
|---|---|
| protected void setupInternals() throws IOException Configure the internal implementation details of the repository.
| |
| setupWorkTree | back to summary |
|---|---|
| protected void setupWorkTree() throws IOException Perform standard work-tree initialization.
This is a method typically invoked inside of
| |
| setWorkTree | back to summary |
|---|---|
| public B setWorkTree(File workTree) Set the top level directory of the working files.
| |