diff --git a/org.eclipse.jgit.ant/src/org/eclipse/jgit/ant/tasks/GitInitTask.java b/org.eclipse.jgit.ant/src/org/eclipse/jgit/ant/tasks/GitInitTask.java index cab45e0c0..7b1610eeb 100644 --- a/org.eclipse.jgit.ant/src/org/eclipse/jgit/ant/tasks/GitInitTask.java +++ b/org.eclipse.jgit.ant/src/org/eclipse/jgit/ant/tasks/GitInitTask.java @@ -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); + } } }