public class InitCommand extends java.lang.Object implements java.util.concurrent.Callable<Git>
Modifier and Type | Field and Description |
---|---|
private boolean |
bare |
private java.io.File |
directory |
private FS |
fs |
private java.io.File |
gitDir |
Constructor and Description |
---|
InitCommand() |
Modifier and Type | Method and Description |
---|---|
Git |
call() |
InitCommand |
setBare(boolean bare)
Set whether the repository is bare or not
|
InitCommand |
setDirectory(java.io.File directory)
The optional directory associated with the init operation.
|
InitCommand |
setFs(FS fs)
Set the file system abstraction to be used for repositories created by
this command.
|
InitCommand |
setGitDir(java.io.File gitDir)
Set the repository meta directory (.git)
|
private static void |
validateDirs(java.io.File directory,
java.io.File gitDir,
boolean bare) |
private java.io.File directory
private java.io.File gitDir
private boolean bare
private FS fs
public Git call() throws GitAPIException
Executes the Init
command.
call
in interface java.util.concurrent.Callable<Git>
Git
instance that owns the Repository
that it
wraps.GitAPIException
public InitCommand setDirectory(java.io.File directory) throws java.lang.IllegalStateException
directory
- the directory to init tojava.lang.IllegalStateException
- if the combination of directory, gitDir and bare is illegal.
E.g. if for a non-bare repository directory and gitDir point
to the same directory of if for a bare repository both
directory and gitDir are specifiedpublic InitCommand setGitDir(java.io.File gitDir) throws java.lang.IllegalStateException
gitDir
- the repository meta directoryjava.lang.IllegalStateException
- if the combination of directory, gitDir and bare is illegal.
E.g. if for a non-bare repository directory and gitDir point
to the same directory of if for a bare repository both
directory and gitDir are specifiedprivate static void validateDirs(java.io.File directory, java.io.File gitDir, boolean bare) throws java.lang.IllegalStateException
java.lang.IllegalStateException
public InitCommand setBare(boolean bare)
bare
- whether the repository is bare or notjava.lang.IllegalStateException
- if the combination of directory, gitDir and bare is illegal.
E.g. if for a non-bare repository directory and gitDir point
to the same directory of if for a bare repository both
directory and gitDir are specifiedpublic InitCommand setFs(FS fs)
fs
- the abstraction.this
(for chaining calls).