summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov <loskutov@gmx.de>2018-08-19 20:53:31 +0200
committerAndrey Loskutov <loskutov@gmx.de>2018-08-19 20:53:31 +0200
commit5a95e7e74bd18e0719306ac7363b7b60964ff915 (patch)
treef1a270f0327c2aed7c5632df3de8bff192bee20a
parentc23d024ea8fc4a8330a134138d45e61d60403a97 (diff)
downloadjgit-5a95e7e74bd18e0719306ac7363b7b60964ff915.tar.gz
jgit-5a95e7e74bd18e0719306ac7363b7b60964ff915.zip
SubmoduleDeinitTest fails on Windows
Bug: 538068 Change-Id: I982e8b12936582e8e119f45d7a3bf4888d3e0e1a Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleDeinitCommand.java10
2 files changed, 11 insertions, 9 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java
index df4b96398f..815ce9b350 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java
@@ -136,10 +136,12 @@ public class SubmoduleDeinitTest extends RepositoryTestCase {
generator.next();
//want to create a commit inside the repo...
- Repository submoduleLocalRepo = generator.getRepository();
- JGitTestUtil.writeTrashFile(submoduleLocalRepo, "file.txt", "new data");
- Git.wrap(submoduleLocalRepo).commit().setAll(true).setMessage("local commit").call();
-
+ try (Repository submoduleLocalRepo = generator.getRepository()) {
+ JGitTestUtil.writeTrashFile(submoduleLocalRepo, "file.txt",
+ "new data");
+ Git.wrap(submoduleLocalRepo).commit().setAll(true)
+ .setMessage("local commit").call();
+ }
SubmoduleDeinitResult result = runDeinit(new SubmoduleDeinitCommand(db).addPath("sub"));
assertEquals(path, result.getPath());
assertEquals(SubmoduleDeinitCommand.SubmoduleDeinitStatus.DIRTY, result.getStatus());
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleDeinitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleDeinitCommand.java
index 569a8e3596..5a0528b0f5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleDeinitCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleDeinitCommand.java
@@ -227,11 +227,11 @@ public class SubmoduleDeinitCommand
return SubmoduleDeinitStatus.DIRTY;
}
- Repository submoduleRepo = w.getRepository();
-
- Status status = Git.wrap(submoduleRepo).status().call();
- return status.isClean() ? SubmoduleDeinitStatus.SUCCESS
- : SubmoduleDeinitStatus.DIRTY;
+ try (Repository submoduleRepo = w.getRepository()) {
+ Status status = Git.wrap(submoduleRepo).status().call();
+ return status.isClean() ? SubmoduleDeinitStatus.SUCCESS
+ : SubmoduleDeinitStatus.DIRTY;
+ }
}
}