RepoCommand should close opened repos

RepoCommand opend two repos without closing them or returning them to
the caller. This caused certain tests to fail on Windows.

Change-Id: Ia04924aaaad4d16f883b06404c2a85d3f801231f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Christian Halstrick 2014-12-12 00:34:31 +01:00 committed by Matthias Sohn
parent 35c00a7a73
commit 1a054f1229
1 changed files with 2 additions and 0 deletions

View File

@ -193,6 +193,7 @@ public byte[] readFile(String uri, String ref, String path)
try { try {
return readFileFromRepo(repo, ref, path); return readFileFromRepo(repo, ref, path);
} finally { } finally {
repo.close();
FileUtils.delete(dir, FileUtils.RECURSIVE); FileUtils.delete(dir, FileUtils.RECURSIVE);
} }
} }
@ -860,6 +861,7 @@ private void addSubmodule(String url, String name, String revision,
if (revision != null) { if (revision != null) {
Git sub = new Git(subRepo); Git sub = new Git(subRepo);
sub.checkout().setName(findRef(revision, subRepo)).call(); sub.checkout().setName(findRef(revision, subRepo)).call();
subRepo.close();
git.add().addFilepattern(name).call(); git.add().addFilepattern(name).call();
} }
for (CopyFile copyfile : copyfiles) { for (CopyFile copyfile : copyfiles) {