BranchTest: Create Git instances in try-with-resource
Change-Id: I8becee479fab91a18e6daffd6f4fd57338c9d120 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
This commit is contained in:
parent
3b63a242ef
commit
9d721de69b
|
@ -57,7 +57,9 @@ public class BranchTest extends CLIRepositoryTestCase {
|
|||
@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
|
||||
|
@ -77,14 +79,16 @@ public void testListDetached() throws Exception {
|
|||
|
||||
@Test
|
||||
public void testListContains() throws Exception {
|
||||
new Git(db).branchCreate().setName("initial").call();
|
||||
RevCommit second = new Git(db).commit().setMessage("second commit")
|
||||
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
|
||||
public void testExistingBranch() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue