]> source.dussan.org Git - jgit.git/commitdiff
Add better exception handling for the git-init ant task 13/3313/2
authorKetan Padegaonkar <KetanPadegaonkar@gmail.com>
Mon, 2 May 2011 16:48:27 +0000 (09:48 -0700)
committerChris Aniszczyk <caniszczyk@gmail.com>
Tue, 3 May 2011 17:09:04 +0000 (12:09 -0500)
Change-Id: Ia935720fc9c09b427abb84be038c4dc74610850c
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
org.eclipse.jgit.ant/src/org/eclipse/jgit/ant/tasks/GitInitTask.java

index cab45e0c0960a52453a5dd8c4d854c77e049ab57..7b1610eebe31562d9210333ab93155ec9c0fd1d7 100644 (file)
@@ -48,6 +48,7 @@ import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Task;
 import org.eclipse.jgit.api.Git;
 import org.eclipse.jgit.api.InitCommand;
+import org.eclipse.jgit.api.errors.JGitInternalException;
 
 /**
  * Create an empty git repository.
@@ -86,8 +87,12 @@ public class GitInitTask extends Task {
                } else {
                        log("Initializing repository at " + destination);
                }
-               InitCommand init = Git.init();
-               init.setBare(bare).setDirectory(destination);
-               init.call();
+               try {
+                       InitCommand init = Git.init();
+                       init.setBare(bare).setDirectory(destination);
+                       init.call();
+               } catch (JGitInternalException e) {
+                       throw new BuildException("Could not initialize repository", e);
+               }
        }
 }