ReflogTest: Open Git instances in try-with-resource
Change-Id: I950b6f16148cfe11de729b04904f88d6e4c28b9a Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
This commit is contained in:
parent
5ca9aaa172
commit
77887b49f9
|
@ -57,15 +57,17 @@ public void testClean() throws Exception {
|
|||
|
||||
@Test
|
||||
public void testSingleCommit() throws Exception {
|
||||
new Git(db).commit().setMessage("initial commit").call();
|
||||
try (Git git = new Git(db)) {
|
||||
git.commit().setMessage("initial commit").call();
|
||||
|
||||
assertEquals("6fd41be HEAD@{0}: commit (initial): initial commit",
|
||||
execute("git reflog")[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBranch() throws Exception {
|
||||
Git git = new Git(db);
|
||||
try (Git git = new Git(db)) {
|
||||
git.commit().setMessage("first commit").call();
|
||||
git.checkout().setCreateBranch(true).setName("side").call();
|
||||
writeTrashFile("file", "side content");
|
||||
|
@ -78,3 +80,4 @@ public void testBranch() throws Exception {
|
|||
"" }, execute("git reflog refs/heads/side"));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue