Search in sources :

Example 36 with GitCommandLine

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

the class FetchCommandImpl method call.

public void call() throws VcsException {
    final GitCommandLine cmd = getCmd();
    final GitVersion gitVersion = cmd.getGitVersion();
    cmd.addParameter("fetch");
    if (myQuite)
        cmd.addParameter("-q");
    if (myShowProgress)
        cmd.addParameter("--progress");
    if (myDepth != null)
        cmd.addParameter("--depth=" + myDepth);
    if (!myFetchTags)
        cmd.addParameter("--no-tags");
    if (gitVersion.isGreaterThan(new GitVersion(1, 7, 3))) {
        // we process submodules separately
        cmd.addParameter("--recurse-submodules=no");
    }
    cmd.setHasProgress(true);
    if (myRefSpecs.size() > 1 && GitVersion.fetchSupportsStdin(gitVersion)) {
        cmd.addParameter("--stdin");
        cmd.addParameter(getRemote());
        runCmd(cmd.stdErrLogLevel("debug"), refSpecsToBytes(cmd));
    } else {
        cmd.addParameter(getRemote());
        myRefSpecs.forEach(refSpec -> cmd.addParameter(refSpec));
        runCmd(cmd.stdErrLogLevel("debug"));
    }
}
Also used : GitCommandLine(jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine) GitVersion(jetbrains.buildServer.buildTriggers.vcs.git.GitVersion)

Aggregations

GitCommandLine (jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine)36 NotNull (org.jetbrains.annotations.NotNull)6 GitVersion (jetbrains.buildServer.buildTriggers.vcs.git.GitVersion)5 ExecResult (jetbrains.buildServer.ExecResult)4 File (java.io.File)3 VcsException (jetbrains.buildServer.vcs.VcsException)3 AgentGitCommandLine (jetbrains.buildServer.buildTriggers.vcs.git.agent.AgentGitCommandLine)2 AgentGitFacadeImpl (jetbrains.buildServer.buildTriggers.vcs.git.agent.AgentGitFacadeImpl)2 FetchCommandImpl (jetbrains.buildServer.buildTriggers.vcs.git.command.impl.FetchCommandImpl)2 StubContext (jetbrains.buildServer.buildTriggers.vcs.git.command.impl.StubContext)2 SkipException (org.testng.SkipException)2 Test (org.testng.annotations.Test)2 ShowRefResult (jetbrains.buildServer.buildTriggers.vcs.git.agent.command.ShowRefResult)1 Nullable (org.jetbrains.annotations.Nullable)1