summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-05-22 11:27:30 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-05-22 11:49:37 +0900
commitf6c4a492d06e0dd345679bfba3399dabbf778f41 (patch)
treef5a3a1f84d581fcdaae05350f5b1604f54559a4e /org.eclipse.jgit.test/tst
parente701c59a859e8fff46a1bc16aee7771a3a8aea8a (diff)
downloadjgit-f6c4a492d06e0dd345679bfba3399dabbf778f41.tar.gz
jgit-f6c4a492d06e0dd345679bfba3399dabbf778f41.zip
Repository: Deprecate #peel method
Callers should use getRefDatabase().peel(ref) instead since it doesn't swallow the IOException. Adapt all trivial callers to user the alternative. DescribeCommand still uses the deprecated method and is not adapted in this change since it will require more refactoring to add handling of the IOException. Change-Id: I14d4a95a5e0570548753b9fc5c03d024dc3ff832 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java2
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java9
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java2
3 files changed, 8 insertions, 5 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java
index bd0efad016..4ef511e43d 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java
@@ -116,7 +116,7 @@ public class LogCommandTest extends RepositoryTestCase {
Iterator<RevCommit> log = git.log().all().call().iterator();
assertTrue(log.hasNext());
RevCommit commit = log.next();
- tag = db.peel(tag);
+ tag = db.getRefDatabase().peel(tag);
assertEquals(commit.getName(), tag.getPeeledObjectId().getName());
assertTrue(commits.contains(commit));
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java
index 3b29a5bbfb..a220e77e0e 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java
@@ -67,19 +67,22 @@ public class TagCommandTest extends RepositoryTestCase {
RevWalk walk = new RevWalk(db)) {
RevCommit commit = git.commit().setMessage("initial commit").call();
Ref tagRef = git.tag().setName("tag").call();
- assertEquals(commit.getId(), db.peel(tagRef).getPeeledObjectId());
+ assertEquals(commit.getId(),
+ db.getRefDatabase().peel(tagRef).getPeeledObjectId());
assertEquals("tag", walk.parseTag(tagRef.getObjectId()).getTagName());
}
}
@Test
- public void testTagging() throws GitAPIException, JGitInternalException {
+ public void testTagging()
+ throws GitAPIException, JGitInternalException, IOException {
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
RevCommit commit = git.commit().setMessage("second commit").call();
git.commit().setMessage("third commit").call();
Ref tagRef = git.tag().setObjectId(commit).setName("tag").call();
- assertEquals(commit.getId(), db.peel(tagRef).getPeeledObjectId());
+ assertEquals(commit.getId(),
+ db.getRefDatabase().peel(tagRef).getPeeledObjectId());
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
index fa45214f0c..df31ab0869 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
@@ -160,7 +160,7 @@ public class RepoCommandTest extends RepositoryTestCase {
Ref ref = r.findRef(refname);
if (ref == null) return null;
- ref = r.peel(ref);
+ ref = r.getRefDatabase().peel(ref);
ObjectId id = ref.getObjectId();
return id;
} catch (IOException e) {