From d2c2fa7664f24232b0d7b592b6f18140831ccc5d Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Thu, 30 Nov 2017 18:39:48 +0300 Subject: [PATCH] git: use new API for throwing VcsException on command failure --- .../git4idea/src/git4idea/repo/GitRepositoryInitializer.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/plugins/git4idea/src/git4idea/repo/GitRepositoryInitializer.java b/plugins/git4idea/src/git4idea/repo/GitRepositoryInitializer.java index f4bc944c062e..f3f96d4622ec 100644 --- a/plugins/git4idea/src/git4idea/repo/GitRepositoryInitializer.java +++ b/plugins/git4idea/src/git4idea/repo/GitRepositoryInitializer.java @@ -8,7 +8,6 @@ import com.intellij.vcs.VcsRepositoryInitializer; import git4idea.GitVcs; import git4idea.commands.Git; import git4idea.commands.GitCommand; -import git4idea.commands.GitCommandResult; import git4idea.commands.GitLineHandler; import org.jetbrains.annotations.NotNull; @@ -20,9 +19,7 @@ public class GitRepositoryInitializer implements VcsRepositoryInitializer { public void initRepository(@NotNull File rootDir) throws VcsException { // TODO remove the fake project instance when GitHandler knows how to run without project GitLineHandler handler = new GitLineHandler(ProjectManager.getInstance().getDefaultProject(), rootDir, GitCommand.INIT); - GitCommandResult result = Git.getInstance().runCommand(handler); - // TODO change to GitCommandResult.successOrThrow() after the API is ready - if (!result.success()) throw new VcsException(result.getErrorOutputAsJoinedString()); + Git.getInstance().runCommand(handler).getOutputOrThrow(); } @NotNull