]> source.dussan.org Git - jgit.git/commit
InitCommand: Don't leave Repository open after Git is closed 16/117316/3
authorDavid Pursehouse <david.pursehouse@gmail.com>
Wed, 14 Feb 2018 01:13:46 +0000 (10:13 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Wed, 14 Feb 2018 05:09:40 +0000 (14:09 +0900)
commitf527d4548f41436e6e77cd54134f25e1b89ba903
treecc73b24eaa50b183297d08a631112a395bcf54b4
parent19355ce12330a85402fae699c2101275b4272874
InitCommand: Don't leave Repository open after Git is closed

The InitCommand returns a Git that is instantiated with the newly
created Repository, but the Repository is not closed with the Git
resulting in resource leaks.

Create the Git with `closeRepo` set to true, such that the Repository
is also closed when the Git is closed.

Adjust the tests to use try-with-resource on the Git instance.

Change-Id: Ib26e7428c7d8840956d1edb09e53b93e23e6fe5a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/InitCommandTest.java
org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java