Clarify call to InitCommand

This commit is contained in:
Paul Campbell 2018-05-31 23:29:26 +01:00
parent fa9481704a
commit 19b936a067

View file

@ -1,6 +1,7 @@
package net.kemitix.gitdb; package net.kemitix.gitdb;
import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.InitCommand;
import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.GitAPIException;
import java.nio.file.Path; import java.nio.file.Path;
@ -16,10 +17,9 @@ public interface GitDB
* @return a GitDB instance for the created local gitdb * @return a GitDB instance for the created local gitdb
*/ */
static GitDB initLocal(final Path dbDir) throws GitAPIException { static GitDB initLocal(final Path dbDir) throws GitAPIException {
return new GitDBLocal(Git.init() final InitCommand initCommand = Git.init().setGitDir(dbDir.toFile()).setBare(true);
.setGitDir(dbDir.toFile()) final Git git = initCommand.call();
.setBare(true) return new GitDBLocal(git);
.call());
} }
// /** // /**