diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2016-02-12 11:15:19 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2016-02-12 11:15:33 +0100 |
commit | 4dcf34eddfd0d7c52d252e5528e67ad2d3f0869f (patch) | |
tree | 50ff4dfca6de6a52b49164d75e608ee2289606d5 /org.eclipse.jgit.pgm.test | |
parent | 363fc1ff5ba44635086d24884e5556cc0cc4352b (diff) | |
parent | 50e21322de4c366da8c7f662b566b9ab1d06a960 (diff) | |
download | jgit-4dcf34eddfd0d7c52d252e5528e67ad2d3f0869f.tar.gz jgit-4dcf34eddfd0d7c52d252e5528e67ad2d3f0869f.zip |
Merge branch 'stable-4.2'
* stable-4.2:
NoteMapTest: Open TreeWalk instances in try-with-resource
ObjectDirectoryTest: Fix warnings about variable hiding
PackWriterTest: Open RevWalk in try-with-resource
PatchIdDiffFormatterTest: Open Git and PatchIdDiffFormatter in try-with-resource
PathSuffixFilterTest: Open TreeWalk in try-with-resource
PostOrderTreeWalkTest: Open TreeWalk in try-with-resource
PullCommandWithRebaseTest: Open RevWalk in try-with-resource
PushCommandTest: Open Git instances in try-with-resource
RacyGitTests: Open NameConflictTreeWalk in try-with-resource
RecursiveMergerTest: Open TreeWalk and BufferedReader in try-with-resource
ReflogConfigTest: refactor commit method to avoid variable hiding
Update .mailmap
RefDirectoryTest: Fix warning about member variable hiding
ReflogResolveTest: Open Git instances in try-with-resource
ReflogTest: Open Git instances in try-with-resource
RepoCommandTest: Open Git instances in try-with-resource
Change-Id: I7964b699396629e31a9cc5600aedcf4be4e659a8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm.test')
-rw-r--r-- | org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ReflogTest.java | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ReflogTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ReflogTest.java index ce808326b4..7330ee97be 100644 --- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ReflogTest.java +++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ReflogTest.java @@ -57,24 +57,27 @@ public class ReflogTest extends CLIRepositoryTestCase { @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]); + assertEquals("6fd41be HEAD@{0}: commit (initial): initial commit", + execute("git reflog")[0]); + } } @Test public void testBranch() throws Exception { - Git git = new Git(db); - git.commit().setMessage("first commit").call(); - git.checkout().setCreateBranch(true).setName("side").call(); - writeTrashFile("file", "side content"); - git.add().addFilepattern("file").call(); - git.commit().setMessage("side commit").call(); + try (Git git = new Git(db)) { + git.commit().setMessage("first commit").call(); + git.checkout().setCreateBranch(true).setName("side").call(); + writeTrashFile("file", "side content"); + git.add().addFilepattern("file").call(); + git.commit().setMessage("side commit").call(); - assertArrayEquals(new String[] { - "38890c7 side@{0}: commit: side commit", - "d216986 side@{1}: branch: Created from commit first commit", - "" }, execute("git reflog refs/heads/side")); + assertArrayEquals(new String[] { + "38890c7 side@{0}: commit: side commit", + "d216986 side@{1}: branch: Created from commit first commit", + "" }, execute("git reflog refs/heads/side")); + } } }
\ No newline at end of file |