Browse Source

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>
stable-3.6
Christian Halstrick 10 years ago committed by Matthias Sohn
parent
commit
1a054f1229
  1. 2
      org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java

2
org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java

@ -193,6 +193,7 @@ public class RepoCommand extends GitCommand<RevCommit> {
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 @@ public class RepoCommand extends GitCommand<RevCommit> {
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) {

Loading…
Cancel
Save