aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src/org/eclipse
diff options
context:
space:
mode:
authorPhilipp Thun <philipp.thun@sap.com>2011-03-11 15:49:27 +0100
committerPhilipp Thun <philipp.thun@sap.com>2011-03-15 13:57:15 +0100
commit8e1b581d39a8e1eadfb8f2ab7590546ec89c9abe (patch)
treea7e57825e3c29ff2cc4d47aacc5fa59db15e6fbc /org.eclipse.jgit.pgm/src/org/eclipse
parent317d8e2e8dbda0c9dc625b7fd439f78a60079d09 (diff)
downloadjgit-8e1b581d39a8e1eadfb8f2ab7590546ec89c9abe.tar.gz
jgit-8e1b581d39a8e1eadfb8f2ab7590546ec89c9abe.zip
Make --git-dir optional for 'jgit init'
For compatibility reasons with regards to native git and also to make the init command easier to use from the command line, argument --git-dir should not be required. Additionally the path created in case --git-dir is not supplied now is canonical and thus easier to read. Change-Id: Idb7d77e983a78c4b21fbf232fc1e75ef581e5ed1 Signed-off-by: Philipp Thun <philipp.thun@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm/src/org/eclipse')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java3
1 files changed, 2 insertions, 1 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 98f086d460..e1e38e5bc8 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
@@ -69,7 +69,8 @@ class Init extends TextBuiltin {
protected void run() throws Exception {
InitCommand command = Git.init();
command.setBare(bare);
- command.setDirectory(new File(gitdir));
+ if (gitdir != null)
+ command.setDirectory(new File(gitdir));
Repository repository = command.call().getRepository();
out.println(MessageFormat.format(
CLIText.get().initializedEmptyGitRepositoryIn, repository