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

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

Introduction

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

Prototype

public FetchCommand setCheckFetchedObjects(boolean checkFetchedObjects) 

Source Link

Document

If set to true , objects received will be checked for validity

Usage

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

License:Apache License

@Override
public void pullRemote() throws GitException {
    try {//from  w  ww  .  java2  s. co m
        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  w w  w  .j av a 2 s  .c o m*/
@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);
    fetch.setRemoveDeletedRefs(prune);/* w w w. j  a  v a 2s  . c o m*/
    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);
    fetch.setRemoveDeletedRefs(prune);/*from  w  w  w. j a va 2 s . c  o m*/
    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;
}