diff options
author | Chris Aniszczyk <caniszczyk@gmail.com> | 2011-03-15 09:59:24 -0400 |
---|---|---|
committer | Code Review <codereview-daemon@eclipse.org> | 2011-03-15 09:59:24 -0400 |
commit | 2df51d942704e7dc8887acb4d76d8723c108cff0 (patch) | |
tree | 229d47baa0371a591002b8d523064987e1090e6e | |
parent | ed2a8b5acfffba36b19738f313c2c1758ebf44bf (diff) | |
parent | 8e1b581d39a8e1eadfb8f2ab7590546ec89c9abe (diff) | |
download | jgit-2df51d942704e7dc8887acb4d76d8723c108cff0.tar.gz jgit-2df51d942704e7dc8887acb4d76d8723c108cff0.zip |
Merge "Make --git-dir optional for 'jgit init'"
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java | 3 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java | 2 |
2 files changed, 3 insertions, 2 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 diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java index fdadf9690d..d68f4e27f2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java @@ -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(); |