Package org.eclipse.jgit.api
Class InitCommand
- java.lang.Object
-
- org.eclipse.jgit.api.InitCommand
-
- All Implemented Interfaces:
java.util.concurrent.Callable<Git>
public class InitCommand extends java.lang.Object implements java.util.concurrent.Callable<Git>
Create an empty git repository or reinitalize an existing one- See Also:
- Git documentation about init
-
-
Constructor Summary
Constructors Constructor Description InitCommand()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Git
call()
Executes theInit
command.InitCommand
setBare(boolean bare)
InitCommand
setDirectory(java.io.File directory)
The optional directory associated with the init operation.InitCommand
setGitDir(java.io.File gitDir)
-
-
-
Method Detail
-
call
public Git call() throws GitAPIException
Executes theInit
command.- Specified by:
call
in interfacejava.util.concurrent.Callable<Git>
- Returns:
- the newly created
Git
object with associated repository - Throws:
GitAPIException
-
setDirectory
public InitCommand setDirectory(java.io.File directory) throws java.lang.IllegalStateException
The optional directory associated with the init operation. If no directory is set, we'll use the current directory- Parameters:
directory
- the directory to init to- Returns:
- this instance
- Throws:
java.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 specified
-
setGitDir
public InitCommand setGitDir(java.io.File gitDir) throws java.lang.IllegalStateException
- Parameters:
gitDir
- the repository meta directory- Returns:
- this instance
- Throws:
java.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 specified- Since:
- 3.6
-
setBare
public InitCommand setBare(boolean bare)
- Parameters:
bare
- whether the repository is bare or not- Returns:
- this instance
- Throws:
java.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 specified
-
-