Java Code Examples for org.jenkinsci.plugins.gitclient.Git#USE_CLI

The following examples show how to use org.jenkinsci.plugins.gitclient.Git#USE_CLI . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GitAPI.java    From git-client-plugin with MIT License 5 votes vote down vote up
/** {@inheritDoc} */
public void commit(String message, PersonIdent author, PersonIdent committer) throws GitException, InterruptedException {
    if (Git.USE_CLI) {
        super.setAuthor(author);
        super.setCommitter(committer);
        super.commit(message);
    } else {
        jgit.setAuthor(author);
        jgit.setCommitter(committer);
        jgit.commit(message);
    }
}
 
Example 2
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public void deleteBranch(String name) throws GitException, InterruptedException {
    if (Git.USE_CLI) super.deleteBranch(name); else  jgit.deleteBranch(name);
}
 
Example 3
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public void tag(String tagName, String comment) throws GitException, InterruptedException {
    if (Git.USE_CLI) super.tag(tagName, comment); else  jgit.tag(tagName, comment);
}
 
Example 4
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public void fetch(String remoteName, RefSpec... refspec) throws GitException, InterruptedException {
    if (Git.USE_CLI) super.fetch(remoteName, refspec); else  jgit.fetch(remoteName, refspec);
}
 
Example 5
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public void deleteTag(String tagName) throws GitException, InterruptedException {
    if (Git.USE_CLI) super.deleteTag(tagName); else  jgit.deleteTag(tagName);
}
 
Example 6
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public void checkout(String ref) throws GitException, InterruptedException {
    if (Git.USE_CLI) super.checkout().ref(ref).execute(); else  jgit.checkout().ref(ref).execute();
}
 
Example 7
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public boolean tagExists(String tagName) throws GitException, InterruptedException {
    return Git.USE_CLI ? super.tagExists(tagName) :  jgit.tagExists(tagName);
}
 
Example 8
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public boolean isCommitInRepo(ObjectId commit) throws GitException, InterruptedException {
    return Git.USE_CLI ? super.isCommitInRepo(commit) :  jgit.isCommitInRepo(commit);
}
 
Example 9
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public boolean hasGitRepo() throws GitException, InterruptedException {
    return Git.USE_CLI ? super.hasGitRepo() :  jgit.hasGitRepo();
}
 
Example 10
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public void checkout(String ref, String branch) throws GitException, InterruptedException {
    if (Git.USE_CLI) super.checkout().ref(ref).branch(branch).execute(); else  jgit.checkout().ref(ref).branch(branch).execute();
}
 
Example 11
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public void init() throws GitException, InterruptedException {
    if (Git.USE_CLI) super.init(); else  jgit.init();
}
 
Example 12
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public Set<Branch> getRemoteBranches() throws GitException, InterruptedException {
    return Git.USE_CLI ? super.getRemoteBranches() :  jgit.getRemoteBranches();
}
 
Example 13
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public void branch(String name) throws GitException, InterruptedException {
    if (Git.USE_CLI) super.branch(name); else  jgit.branch(name);
}
 
Example 14
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public void setRemoteUrl(String name, String url) throws GitException, InterruptedException {
    if (Git.USE_CLI) super.setRemoteUrl(name, url); else  jgit.setRemoteUrl(name, url);
}
 
Example 15
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public GitClient subGit(String subdir) {
    return Git.USE_CLI ? super.subGit(subdir) :  jgit.subGit(subdir);
}
 
Example 16
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public String getTagMessage(String tagName) throws GitException, InterruptedException {
    return Git.USE_CLI ? super.getTagMessage(tagName) :  jgit.getTagMessage(tagName);
}
 
Example 17
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public void push(String remoteName, String refspec) throws GitException, InterruptedException {
    if (Git.USE_CLI) super.push(remoteName, refspec); else  jgit.push(remoteName, refspec);
}
 
Example 18
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public String getRemoteUrl(String name) throws GitException, InterruptedException {
    return Git.USE_CLI ? super.getRemoteUrl(name) :  jgit.getRemoteUrl(name);
}
 
Example 19
Source File: GitAPI.java    From git-client-plugin with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
public void clean() throws GitException, InterruptedException {
    if (Git.USE_CLI) super.clean(); else  jgit.clean();
}
 
Example 20
Source File: GitAPI.java    From git-client-plugin with MIT License 3 votes vote down vote up
/**
 * Constructor for GitAPI.
 *
 * @param gitExe name of git executable (git or git.exe or jgit)
 * @param repository a {@link hudson.FilePath} for the repository directory
 * @param listener a {@link hudson.model.TaskListener} which monitors the git work
 * @param environment the {@link hudson.EnvVars} environment for the build
 * @throws java.io.IOException if any IO failure
 * @throws java.lang.InterruptedException if interrupted.
 */
@Deprecated
public GitAPI(String gitExe, File repository, TaskListener listener, EnvVars environment) throws IOException, InterruptedException {
    super(gitExe, repository, listener, environment);

    // If USE_CLI is forced, don't delegate to JGit client
    this.jgit = Git.USE_CLI ? null : Git.with(listener, environment).in(repository).using("jgit").getClient();
}