diff options
author | David Pursehouse <david.pursehouse@sonymobile.com> | 2016-02-12 13:43:56 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2016-02-12 13:43:56 +0900 |
commit | 964da41d52258e88d4f79b0d483a7ee5505c7f0e (patch) | |
tree | cba6c8ae6522c5eedb25c55fff00f002ab9437f6 | |
parent | 767d5f4e59fc9901d5348154c78db5d90a04bfca (diff) | |
download | jgit-964da41d52258e88d4f79b0d483a7ee5505c7f0e.tar.gz jgit-964da41d52258e88d4f79b0d483a7ee5505c7f0e.zip |
ReflogConfigTest: refactor commit method to avoid variable hiding
The author and committer parameters were hiding class members of
the same name.
Since the passed in PersonIdent instances were being created from
the class members anyway, remove the parameters and instead create
the PersonIdent instances inline in the method.
Change-Id: I66b057df388835d57f332fdcbadb8a9f4e1094a4
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java index 7b6d7d4b0d..df1a52dc09 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java @@ -70,8 +70,7 @@ public class ReflogConfigTest extends RepositoryTestCase { // do one commit and check that reflog size is 0: no reflogs should be // written - commit("A Commit\n", new PersonIdent(author, commitTime, tz), - new PersonIdent(committer, commitTime, tz)); + commit("A Commit\n", commitTime, tz); commitTime += 60 * 1000; assertTrue( "Reflog for HEAD still contain no entry", @@ -83,8 +82,7 @@ public class ReflogConfigTest extends RepositoryTestCase { assertTrue(cfg.get(CoreConfig.KEY).isLogAllRefUpdates()); // do one commit and check that reflog size is increased to 1 - commit("A Commit\n", new PersonIdent(author, commitTime, tz), - new PersonIdent(committer, commitTime, tz)); + commit("A Commit\n", commitTime, tz); commitTime += 60 * 1000; assertTrue( "Reflog for HEAD should contain one entry", @@ -96,18 +94,17 @@ public class ReflogConfigTest extends RepositoryTestCase { assertFalse(cfg.get(CoreConfig.KEY).isLogAllRefUpdates()); // do one commit and check that reflog size is 2 - commit("A Commit\n", new PersonIdent(author, commitTime, tz), - new PersonIdent(committer, commitTime, tz)); + commit("A Commit\n", commitTime, tz); assertTrue( "Reflog for HEAD should contain two entries", db.getReflogReader(Constants.HEAD).getReverseEntries().size() == 2); } - private void commit(String commitMsg, PersonIdent author, - PersonIdent committer) throws IOException { + private void commit(String commitMsg, long commitTime, int tz) + throws IOException { final CommitBuilder commit = new CommitBuilder(); - commit.setAuthor(author); - commit.setCommitter(committer); + commit.setAuthor(new PersonIdent(author, commitTime, tz)); + commit.setCommitter(new PersonIdent(committer, commitTime, tz)); commit.setMessage(commitMsg); ObjectId id; try (ObjectInserter inserter = db.newObjectInserter()) { |