From 8e1b581d39a8e1eadfb8f2ab7590546ec89c9abe Mon Sep 17 00:00:00 2001 From: Philipp Thun Date: Fri, 11 Mar 2011 15:49:27 +0100 Subject: 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 --- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'org.eclipse.jgit.pgm/src/org/eclipse') 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 -- cgit v1.2.3