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>tags/v0.12.1
@@ -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 |
@@ -83,7 +83,7 @@ public class InitCommand implements Callable<Git> { | |||
} else if (builder.getGitDir() == null) { | |||
File d = new File("."); | |||
if (!bare) | |||
d = new File(d, Constants.DOT_GIT); | |||
d = new File(d, Constants.DOT_GIT).getCanonicalFile(); | |||
builder.setGitDir(d); | |||
} | |||
Repository repository = builder.build(); |