@Before
public void setUp() throws Exception {
super.setUp();
- new Git(db).commit().setMessage("initial commit").call();
+ try (Git git = new Git(db)) {
+ git.commit().setMessage("initial commit").call();
+ }
}
@Test
@Test
public void testListContains() throws Exception {
- new Git(db).branchCreate().setName("initial").call();
- RevCommit second = new Git(db).commit().setMessage("second commit")
- .call();
- assertArrayOfLinesEquals(new String[] { " initial", "* master", "" },
- execute("git branch --contains 6fd41be"));
- assertArrayOfLinesEquals(new String[] { "* master", "" },
- execute("git branch --contains " + second.name()));
+ try (Git git = new Git(db)) {
+ git.branchCreate().setName("initial").call();
+ RevCommit second = git.commit().setMessage("second commit")
+ .call();
+ assertArrayOfLinesEquals(new String[] { " initial", "* master", "" },
+ execute("git branch --contains 6fd41be"));
+ assertArrayOfLinesEquals(new String[] { "* master", "" },
+ execute("git branch --contains " + second.name()));
+ }
}
@Test