aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Aniszczyk <caniszczyk@gmail.com>2010-12-06 17:09:14 -0500
committerCode Review <codereview-daemon@eclipse.org>2010-12-06 17:09:14 -0500
commit6d08252b11e7dd30939ce61cd1c5b1bdbbd1e89a (patch)
tree775687011ba4e736e9e6c46703fc75cddd3ffcaf
parenta2469bb5d228d6fdcda40aa8f56674fa89e66f84 (diff)
parent8f6c8818dcbcbeadcdd2c4f20e23dff4fc0e8517 (diff)
downloadjgit-6d08252b11e7dd30939ce61cd1c5b1bdbbd1e89a.tar.gz
jgit-6d08252b11e7dd30939ce61cd1c5b1bdbbd1e89a.zip
Merge "Update Init to use InitCommand"
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java16
1 files changed, 7 insertions, 9 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java
index 89a08fda62..497be909be 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java
@@ -3,6 +3,7 @@
* Copyright (C) 2008, Google Inc.
* Copyright (C) 2010, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2010, Sasa Zivkov <sasa.zivkov@sap.com>
+ * Copyright (C) 2010, Chris Aniszczyk <caniszczyk@gmail.com>
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
@@ -46,12 +47,11 @@
package org.eclipse.jgit.pgm;
-import java.io.File;
import java.text.MessageFormat;
+import org.eclipse.jgit.api.Git;
+import org.eclipse.jgit.api.InitCommand;
import org.kohsuke.args4j.Option;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.storage.file.FileRepository;
@Command(common = true, usage = "usage_CreateAnEmptyGitRepository")
class Init extends TextBuiltin {
@@ -65,12 +65,10 @@ class Init extends TextBuiltin {
@Override
protected void run() throws Exception {
- if (gitdir == null)
- gitdir = new File(bare ? "." : Constants.DOT_GIT);
- else
- bare = true;
- db = new FileRepository(gitdir);
- db.create(bare);
+ InitCommand command = Git.init();
+ command.setBare(bare);
+ command.setDirectory(gitdir);
+ command.call();
out.println(MessageFormat.format(CLIText.get().initializedEmptyGitRepositoryIn, gitdir.getAbsolutePath()));
}
}