summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm
diff options
context:
space:
mode:
authorChris Aniszczyk <caniszczyk@gmail.com>2010-12-07 09:10:07 -0600
committerChris Aniszczyk <caniszczyk@gmail.com>2010-12-07 09:10:07 -0600
commit8bbd4f1badd8b9d607a9078a7311b2064a9b0ac7 (patch)
tree513c6c3ced16da97884cde06fe5f5d375da16c4b /org.eclipse.jgit.pgm
parent48b73efe1e08c5aea4422cf13bd09d92fcde2511 (diff)
downloadjgit-8bbd4f1badd8b9d607a9078a7311b2064a9b0ac7.tar.gz
jgit-8bbd4f1badd8b9d607a9078a7311b2064a9b0ac7.zip
Avoid NPE in Init
We should grab the repository directory from the command to avoid an NPE if no git directory is passed in via the CLI. Change-Id: I649467c6d84bbc0d26a070d0d4ff1e6f81fd5bad Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java7
1 files changed, 5 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 497be909be..c56540a76a 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
@@ -51,6 +51,7 @@ import java.text.MessageFormat;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.InitCommand;
+import org.eclipse.jgit.lib.Repository;
import org.kohsuke.args4j.Option;
@Command(common = true, usage = "usage_CreateAnEmptyGitRepository")
@@ -68,7 +69,9 @@ class Init extends TextBuiltin {
InitCommand command = Git.init();
command.setBare(bare);
command.setDirectory(gitdir);
- command.call();
- out.println(MessageFormat.format(CLIText.get().initializedEmptyGitRepositoryIn, gitdir.getAbsolutePath()));
+ Repository repository = command.call().getRepository();
+ out.println(MessageFormat.format(
+ CLIText.get().initializedEmptyGitRepositoryIn, repository
+ .getDirectory().getAbsolutePath()));
}
}