Source:
public Collection<String> call() throws InvalidConfigurationException, NoHeadException, ConcurrentRefUpdateException, CheckoutConflictException, InvalidMergeHeadsException, WrongRepositoryStateException, NoMessageException, NoHeadException, RefNotFoundException, GitAPIException { checkCallable(); try { SubmoduleWalk generator = SubmoduleWalk.forIndex(repo); if (!paths.isEmpty()) generator.setFilter(PathFilterGroup.createFromStrings(paths)); List<String> updated = new ArrayList<String>(); while (generator.next()) { if (generator.getModulesPath() == null) continue; String url = generator.getConfigUrl(); if (url == null) continue; Repository submoduleRepo = generator.getRepository(); if (submoduleRepo == null) { CloneCommand clone = Git.cloneRepository(); configure(clone); clone.setURI(url); clone.setDirectory(generator.getDirectory()); if (monitor != null) clone.setProgressMonitor(monitor); submoduleRepo = clone.call().getRepository(); } try { RevWalk walk = new RevWalk(submoduleRepo); RevCommit commit = walk .parseCommit(generator.getObjectId()); String update = generator.getConfigUpdate(); if (ConfigConstants.CONFIG_KEY_MERGE.equals(update)) { MergeCommand merge = new Git(submoduleRepo).merge(); merge.include(commit); merge.setStrategy(strategy); merge.call(); } else if (ConfigConstants.CONFIG_KEY_REBASE.equals(update)) { RebaseCommand rebase = new Git(submoduleRepo).rebase(); rebase.setUpstream(commit); rebase.setStrategy(strategy); rebase.call(); } else { DirCacheCheckout co = new DirCacheCheckout( submoduleRepo, submoduleRepo.lockDirCache(), commit.getTree()); co.setFailOnConflict(true); co.checkout(); RefUpdate refUpdate = submoduleRepo.updateRef( Constants.HEAD, true); refUpdate.setNewObjectId(commit); refUpdate.forceUpdate(); } } finally { submoduleRepo.close(); } updated.add(generator.getPath()); } return updated; } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } catch (ConfigInvalidException e) { throw new InvalidConfigurationException(e.getMessage(), e); } }

Target:
public Collection<String> call() throws InvalidConfigurationException, NoHeadException, ConcurrentRefUpdateException, CheckoutConflictException, InvalidMergeHeadsException, WrongRepositoryStateException, NoMessageException, NoHeadException, RefNotFoundException, GitAPIException { checkCallable(); try { SubmoduleWalk generator = SubmoduleWalk.forIndex(repo); if (!paths.isEmpty()) generator.setFilter(PathFilterGroup.createFromStrings(paths)); List<String> updated = new ArrayList<String>(); while (generator.next()) { if (generator.getModulesPath() == null) continue; String url = generator.getConfigUrl(); if (url == null) continue; Repository submoduleRepo = generator.getRepository(); if (submoduleRepo == null) { CloneCommand clone = Git.cloneRepository(); configure(clone); clone.setURI(url); clone.setDirectory(generator.getDirectory()); if (monitor != null) clone.setProgressMonitor(monitor); submoduleRepo = clone.call().getRepository(); } try { RevWalk walk = new RevWalk(submoduleRepo); RevCommit commit = walk .parseCommit(generator.getObjectId()); String update = generator.getConfigUpdate(); if (ConfigConstants.CONFIG_KEY_MERGE.equals(update)) { MergeCommand merge = new MergeCommand(submoduleRepo); merge.include(commit); merge.setStrategy(strategy); merge.call(); } else if (ConfigConstants.CONFIG_KEY_REBASE.equals(update)) { RebaseCommand rebase = new RebaseCommand(submoduleRepo); rebase.setUpstream(commit); rebase.setStrategy(strategy); rebase.call(); } else { DirCacheCheckout co = new DirCacheCheckout( submoduleRepo, submoduleRepo.lockDirCache(), commit.getTree()); co.setFailOnConflict(true); co.checkout(); RefUpdate refUpdate = submoduleRepo.updateRef( Constants.HEAD, true); refUpdate.setNewObjectId(commit); refUpdate.forceUpdate(); } } finally { submoduleRepo.close(); } updated.add(generator.getPath()); } return updated; } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } catch (ConfigInvalidException e) { throw new InvalidConfigurationException(e.getMessage(), e); } }