Move MemRefDatabase creation in a separate method.
The InMemoryRepository is used in tests (e.g. in gerrit tests) and it
can be useful to create a custom MemRefDatabase for some tests.
Change-Id: I6fbbbfe04400ea1edc988c8788c8eeb06ca8480a
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/InMemoryRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/InMemoryRepository.java
index 5a8207e..583b8b3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/InMemoryRepository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/InMemoryRepository.java
@@ -66,7 +66,16 @@ public InMemoryRepository(DfsRepositoryDescription repoDesc) {
InMemoryRepository(Builder builder) {
super(builder);
objdb = new MemObjDatabase(this);
- refdb = new MemRefDatabase();
+ refdb = createRefDatabase();
+ }
+
+ /**
+ * Creates a new in-memory ref database.
+ *
+ * @return a new in-memory reference database.
+ */
+ protected MemRefDatabase createRefDatabase() {
+ return new MemRefDatabase();
}
/** {@inheritDoc} */