[infer] Fix SubmoduleWalk leaks in submodule commands
Bug: 509385 Change-Id: I4cba81d8ea596800a40799dc9cb763fae01fe508 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
fbcc2cb4ca
commit
aa199ff648
|
@ -94,8 +94,7 @@ public SubmoduleInitCommand addPath(final String path) {
|
||||||
public Collection<String> call() throws GitAPIException {
|
public Collection<String> call() throws GitAPIException {
|
||||||
checkCallable();
|
checkCallable();
|
||||||
|
|
||||||
try {
|
try (SubmoduleWalk generator = SubmoduleWalk.forIndex(repo)) {
|
||||||
SubmoduleWalk generator = SubmoduleWalk.forIndex(repo);
|
|
||||||
if (!paths.isEmpty())
|
if (!paths.isEmpty())
|
||||||
generator.setFilter(PathFilterGroup.createFromStrings(paths));
|
generator.setFilter(PathFilterGroup.createFromStrings(paths));
|
||||||
StoredConfig config = repo.getConfig();
|
StoredConfig config = repo.getConfig();
|
||||||
|
|
|
@ -94,8 +94,7 @@ public SubmoduleStatusCommand addPath(final String path) {
|
||||||
public Map<String, SubmoduleStatus> call() throws GitAPIException {
|
public Map<String, SubmoduleStatus> call() throws GitAPIException {
|
||||||
checkCallable();
|
checkCallable();
|
||||||
|
|
||||||
try {
|
try (SubmoduleWalk generator = SubmoduleWalk.forIndex(repo)) {
|
||||||
SubmoduleWalk generator = SubmoduleWalk.forIndex(repo);
|
|
||||||
if (!paths.isEmpty())
|
if (!paths.isEmpty())
|
||||||
generator.setFilter(PathFilterGroup.createFromStrings(paths));
|
generator.setFilter(PathFilterGroup.createFromStrings(paths));
|
||||||
Map<String, SubmoduleStatus> statuses = new HashMap<String, SubmoduleStatus>();
|
Map<String, SubmoduleStatus> statuses = new HashMap<String, SubmoduleStatus>();
|
||||||
|
|
|
@ -111,8 +111,7 @@ protected String getHeadBranch(final Repository subRepo) throws IOException {
|
||||||
public Map<String, String> call() throws GitAPIException {
|
public Map<String, String> call() throws GitAPIException {
|
||||||
checkCallable();
|
checkCallable();
|
||||||
|
|
||||||
try {
|
try (SubmoduleWalk generator = SubmoduleWalk.forIndex(repo)) {
|
||||||
SubmoduleWalk generator = SubmoduleWalk.forIndex(repo);
|
|
||||||
if (!paths.isEmpty())
|
if (!paths.isEmpty())
|
||||||
generator.setFilter(PathFilterGroup.createFromStrings(paths));
|
generator.setFilter(PathFilterGroup.createFromStrings(paths));
|
||||||
Map<String, String> synced = new HashMap<String, String>();
|
Map<String, String> synced = new HashMap<String, String>();
|
||||||
|
|
Loading…
Reference in New Issue