List of usage examples for org.eclipse.jgit.submodule SubmoduleWalk close
@Override public void close()
Release any resources used by this walker's reader.
From source file:org.gradle.vcs.fixtures.GitFileRepository.java
License:Apache License
/** * Updates any submodules in this repository to the latest in the submodule origin repository *//* www.jav a 2 s .c o m*/ public RevCommit updateSubmodulesToLatest() throws GitAPIException { List<String> submodulePaths = Lists.newArrayList(); try { SubmoduleWalk walker = SubmoduleWalk.forIndex(git.getRepository()); try { while (walker.next()) { Repository submodule = walker.getRepository(); try { submodulePaths.add(walker.getPath()); Git.wrap(submodule).pull().call(); } finally { submodule.close(); } } } finally { walker.close(); } return commit("update submodules", submodulePaths.toArray(new String[submodulePaths.size()])); } catch (IOException e) { throw UncheckedException.throwAsUncheckedException(e); } }
From source file:org.gradle.vcs.git.internal.GitVersionControlSystem.java
License:Apache License
private static void updateSubModules(Git git) throws IOException, GitAPIException { SubmoduleWalk walker = SubmoduleWalk.forIndex(git.getRepository()); try {/* w w w .ja va 2 s . c om*/ while (walker.next()) { Repository submodule = walker.getRepository(); try { Git submoduleGit = Git.wrap(submodule); submoduleGit.fetch().call(); git.submoduleUpdate().addPath(walker.getPath()).call(); submoduleGit.reset().setMode(ResetCommand.ResetType.HARD).call(); updateSubModules(submoduleGit); } finally { submodule.close(); } } } finally { walker.close(); } }