Search in sources :

Example 11 with GitExec

use of jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec in project teamcity-git by JetBrains.

the class GitRepoOperationsImpl method detectGitInternal.

@NotNull
private GitExec detectGitInternal() throws VcsException {
    final String gitPath = myConfig.getPathToGit();
    if (StringUtil.isEmpty(gitPath)) {
        throw new VcsException("No path to git provided: please specify path to git executable using \"teamcity.server.git.executable.path\" server startup property");
    }
    GitVersion gitVersion;
    try {
        gitVersion = IOGuard.allowCommandLine(() -> new GitFacadeImpl(new File("."), new StubContext(gitPath)).version().call());
    } catch (VcsException e) {
        throw new VcsException("Unable to run git at path \"" + gitPath + "\": please specify correct path to git executable using \"teamcity.server.git.executable.path\" server startup property, error: " + e.getMessage(), e);
    }
    if (gitVersion.isSupported()) {
        return new GitExec(gitPath, gitVersion, null);
    }
    throw new VcsException("TeamCity supports git version " + GitVersion.DEPRECATED + " or higher, detected git (path \"" + gitPath + "\") has version " + gitVersion + ".\n" + "Please install the latest git version");
}
Also used : VcsException(jetbrains.buildServer.vcs.VcsException) GitExec(jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

GitExec (jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec)11 NotNull (org.jetbrains.annotations.NotNull)5 VcsException (jetbrains.buildServer.vcs.VcsException)4 File (java.io.File)2 GitVersion (jetbrains.buildServer.buildTriggers.vcs.git.GitVersion)2 VcsRoot (jetbrains.buildServer.vcs.VcsRoot)2 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 ExecResult (jetbrains.buildServer.ExecResult)1 AgentRunningBuild (jetbrains.buildServer.agent.AgentRunningBuild)1 BuildAgentConfiguration (jetbrains.buildServer.agent.BuildAgentConfiguration)1 AgentCheckoutAbility (jetbrains.buildServer.agent.vcs.AgentCheckoutAbility)1 GitProgressLogger (jetbrains.buildServer.buildTriggers.vcs.git.GitProgressLogger)1 AgentGitFacadeImpl (jetbrains.buildServer.buildTriggers.vcs.git.agent.AgentGitFacadeImpl)1 GitAgentSSHService (jetbrains.buildServer.buildTriggers.vcs.git.agent.GitAgentSSHService)1 GitDetector (jetbrains.buildServer.buildTriggers.vcs.git.agent.GitDetector)1 PluginConfigImpl (jetbrains.buildServer.buildTriggers.vcs.git.agent.PluginConfigImpl)1 Context (jetbrains.buildServer.buildTriggers.vcs.git.command.Context)1 NativeGitCommands (jetbrains.buildServer.buildTriggers.vcs.git.command.NativeGitCommands)1