diff options
author | Dave Borowitz <dborowitz@google.com> | 2015-03-17 15:15:45 -0700 |
---|---|---|
committer | Dave Borowitz <dborowitz@google.com> | 2015-03-18 06:59:55 -0700 |
commit | be08dcb6b546064ca614cb4df663e237de503337 (patch) | |
tree | f0c80939ba18bfdb73582ec255d6e6f4d422dded | |
parent | fd402f71a3c7cfd62d3ec0963e803ecbb875d210 (diff) | |
download | jgit-be08dcb6b546064ca614cb4df663e237de503337.tar.gz jgit-be08dcb6b546064ca614cb4df663e237de503337.zip |
TestRepository: Expose a Git instance
Change-Id: I2fab7dd9a24205686db4724e77c0fd0a28f2075e
-rw-r--r-- | org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java index be17bcdc79..ce33ec7094 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java @@ -58,6 +58,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import org.eclipse.jgit.api.Git; import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.dircache.DirCacheBuilder; import org.eclipse.jgit.dircache.DirCacheEditor; @@ -127,6 +128,8 @@ public class TestRepository<R extends Repository> { private final R db; + private final Git git; + private final RevWalk pool; private final ObjectInserter inserter; @@ -155,6 +158,7 @@ public class TestRepository<R extends Repository> { */ public TestRepository(R db, RevWalk rw) throws IOException { this.db = db; + this.git = Git.wrap(db); this.pool = rw; this.inserter = db.newObjectInserter(); this.now = 1236977987000L; @@ -170,6 +174,14 @@ public class TestRepository<R extends Repository> { return pool; } + /** + * @return an API wrapper for the underlying repository. This wrapper does + * not allocate any new resources and need not be closed (but closing + * it is harmless). */ + public Git git() { + return git; + } + /** @return current time adjusted by {@link #tick(int)}. */ public Date getClock() { return new Date(now); |