public static void main(String[] args) throws IOException, GitAPIException { try (Repository repository = CookbookHelper.openJGitCookbookRepository()) { System.out.println("Starting fetch"); try (Git git = new Git(repository)) { FetchResult result = git.fetch().setCheckFetchedObjects(true).call(); System.out.println("Messages: " + result.getMessages()); } } } }
public static void main(String[] args) throws IOException, GitAPIException { try (Repository repository = CookbookHelper.openJGitCookbookRepository()) { System.out.println("Starting fetch"); try (Git git = new Git(repository)) { FetchResult result = git.fetch().setCheckFetchedObjects(true).call(); System.out.println("Messages: " + result.getMessages()); } } } }
command.setCheckFetchedObjects(settings.valueOfIndex("checkFetchedObjects").toBoolean()); command.setDryRun(settings.valueOfIndex("dryRun").toBoolean()); command.setRemoveDeletedRefs(settings.valueOfIndex("removeDeletedRefs").toBoolean());
FetchResult result = git.fetch().setCheckFetchedObjects(true).call(); System.out.println("Messages: " + result.getMessages());
FetchResult result = git.fetch().setCheckFetchedObjects(true).call(); System.out.println("Messages: " + result.getMessages());
.setProgressMonitor(monitor) .setTagOpt(tagOption) .setCheckFetchedObjects(checkFetchedObjects) .setRemoveDeletedRefs(isRemoveDeletedRefs()) .setThin(thin)
public void fetchRemotes() throws Exception { git.fetch().setTagOpt(TagOpt.FETCH_TAGS).setCheckFetchedObjects(false).setRemoveDeletedRefs(true).call(); }
@Override protected void run() throws Exception { Git git = new Git(db); FetchCommand fetch = git.fetch(); if (fsck != null) fetch.setCheckFetchedObjects(fsck.booleanValue()); if (prune != null) fetch.setRemoveDeletedRefs(prune.booleanValue()); if (toget != null) fetch.setRefSpecs(toget); if (tags != null) { fetch.setTagOpt(tags.booleanValue() ? TagOpt.FETCH_TAGS : TagOpt.NO_TAGS); } if (0 <= timeout) fetch.setTimeout(timeout); fetch.setDryRun(dryRun); fetch.setRemote(remote); if (thin != null) fetch.setThin(thin.booleanValue()); if (quiet == null || !quiet.booleanValue()) fetch.setProgressMonitor(new TextProgressMonitor()); FetchResult result = fetch.call(); if (result.getTrackingRefUpdates().isEmpty()) return; showFetchResult(result); } }
@Override public Status call() throws Exception { LOG.info("Starting repository synchronization"); try (Git git = getWorkingFileRepository()) { // Set fetch repo config.configure(git.remoteSetUrl(), fetchUrl, false).call(); config.configure(git.remoteSetUrl(), pushRepository, true).call(); // Fetch repo config.configure(git.fetch()).setCheckFetchedObjects(true).call(); // Push repo config.configure(git.push()).setForce(true).call(); // Sync working tree return pushRepository.call(); } finally { LOG.info("Finished repository synchronization"); // Close repository and free resources config.getWorkingFileRepository().close(); } }
final String refName = Constants.R_HEADS + remoteBranch(); final FetchResult fetchResult = fetch.setRefSpecs(new RefSpec(refName)) .setCheckFetchedObjects(true) .setRemoveDeletedRefs(true) .setTagOpt(TagOpt.NO_TAGS)
final String refName = Constants.R_HEADS + remoteBranch(); final FetchResult fetchResult = fetch.setRefSpecs(new RefSpec(refName)) .setCheckFetchedObjects(true) .setRemoveDeletedRefs(true) .setTagOpt(TagOpt.NO_TAGS)
@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); 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; }
final String refName = Constants.R_HEADS + remoteBranch(); final FetchResult fetchResult = fetch.setRefSpecs(new RefSpec(refName)) .setCheckFetchedObjects(true) .setRemoveDeletedRefs(true) .setTagOpt(TagOpt.NO_TAGS)
.setProgressMonitor(monitor) .setTagOpt(tagOption) .setCheckFetchedObjects(checkFetchedObjects) .setRemoveDeletedRefs(isRemoveDeletedRefs()) .setThin(thin)