Example usage for org.eclipse.jgit.api FetchCommand setThin

List of usage examples for org.eclipse.jgit.api FetchCommand setThin

Introduction

In this page you can find the example usage for org.eclipse.jgit.api FetchCommand setThin.

Prototype

public FetchCommand setThin(boolean thin) 

Source Link

Document

Sets the thin-pack preference for fetch operation.

Usage

From source file:net.erdfelt.android.sdkfido.git.internal.InternalGit.java

License:Apache License

@Override
public void pullRemote() throws GitException {
    try {//from   www. j av a  2s . c  om
        Git git = new Git(repo);
        FetchCommand fetch = git.fetch();
        fetch.setCheckFetchedObjects(false);
        fetch.setRemoveDeletedRefs(true);
        List<RefSpec> specs = new ArrayList<RefSpec>();
        fetch.setRefSpecs(specs);
        fetch.setTimeout(5000);
        fetch.setDryRun(false);
        fetch.setRemote(IGit.REMOTE_NAME);
        fetch.setThin(Transport.DEFAULT_FETCH_THIN);
        fetch.setProgressMonitor(getProgressMonitor());

        FetchResult result = fetch.call();
        if (result.getTrackingRefUpdates().isEmpty()) {
            return;
        }

        GitInfo.infoFetchResults(repo, result);
    } catch (Throwable t) {
        throw new GitException(t.getMessage(), t);
    }
}

From source file:org.ajoberstar.gradle.git.tasks.GitFetch.java

License:Apache License

/**
 * Fetches remote changes into a local Git repository.
 *//*from ww  w.  ja  v  a2  s  .com*/
@TaskAction
public void fetch() {
    FetchCommand cmd = getGit().fetch();
    TransportAuthUtil.configure(cmd, this);
    cmd.setTagOpt(getTagOpt());
    cmd.setCheckFetchedObjects(getCheckFetchedObjects());
    cmd.setDryRun(getDryRun());
    cmd.setRefSpecs(getRefspecs());
    cmd.setRemote(getRemote());
    cmd.setRemoveDeletedRefs(getRemoveDeletedRefs());
    cmd.setThin(getThin());
    try {
        cmd.call();
    } catch (InvalidRemoteException e) {
        throw new GradleException("Invalid remote specified: " + getRemote(), e);
    } catch (TransportException e) {
        throw new GradleException("Problem with transport.", e);
    } catch (GitAPIException e) {
        throw new GradleException("Problem with fetch.", e);
    }
    //TODO add progress monitor to log progress to Gradle status bar
}

From source file:org.jboss.forge.addon.git.GitUtilsImpl.java

License:Open Source License

@Override
public FetchResult fetch(final Git git, final String remote, final String refSpec, final int timeout,
        final boolean fsck, final boolean dryRun, final boolean thin, final boolean prune)
        throws GitAPIException {
    FetchCommand fetch = git.fetch();
    fetch.setCheckFetchedObjects(fsck);//from   w ww.j  av  a 2s . c om
    fetch.setRemoveDeletedRefs(prune);
    if (refSpec != null)
        fetch.setRefSpecs(new RefSpec(refSpec));
    if (timeout >= 0)
        fetch.setTimeout(timeout);
    fetch.setDryRun(dryRun);
    fetch.setRemote(remote);
    fetch.setThin(thin);
    fetch.setProgressMonitor(new TextProgressMonitor());

    FetchResult result = fetch.call();
    return result;
}

From source file:org.jboss.forge.git.GitUtils.java

License:Open Source License

public static FetchResult fetch(final Git git, final String remote, final String refSpec, final int timeout,
        final boolean fsck, final boolean dryRun, final boolean thin, final boolean prune)
        throws GitAPIException {
    FetchCommand fetch = git.fetch();
    fetch.setCheckFetchedObjects(fsck);/*from   w w  w. j  a v a2s  .c o m*/
    fetch.setRemoveDeletedRefs(prune);
    if (refSpec != null)
        fetch.setRefSpecs(new RefSpec(refSpec));
    if (timeout >= 0)
        fetch.setTimeout(timeout);
    fetch.setDryRun(dryRun);
    fetch.setRemote(remote);
    fetch.setThin(thin);
    fetch.setProgressMonitor(new TextProgressMonitor());

    FetchResult result = fetch.call();
    return result;
}