summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java
index fbb24c1577..b0f772e0aa 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java
@@ -133,7 +133,9 @@ public class SubmoduleAddCommand extends
*/
protected boolean submoduleExists() throws IOException {
TreeFilter filter = PathFilter.create(path);
- return SubmoduleWalk.forIndex(repo).setFilter(filter).next();
+ try (SubmoduleWalk w = SubmoduleWalk.forIndex(repo)) {
+ return w.setFilter(filter).next();
+ }
}
/**
@@ -178,7 +180,11 @@ public class SubmoduleAddCommand extends
clone.setURI(resolvedUri);
if (monitor != null)
clone.setProgressMonitor(monitor);
- Repository subRepo = clone.call().getRepository();
+ Repository subRepo = null;
+ try (Git git = clone.call()) {
+ subRepo = git.getRepository();
+ subRepo.incrementOpen();
+ }
// Save submodule URL to parent repository's config
StoredConfig config = repo.getConfig();