aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorkylezhao <kylezhao@tencent.com>2022-12-12 14:49:16 +0800
committerkylezhao <kylezhao@tencent.com>2023-01-04 14:50:38 +0800
commit414bfe05ff3c9fbca5767116348a4de1d7b95841 (patch)
tree061002f2057bd33c1cfe36950de3cbe4000a8275 /org.eclipse.jgit.test
parent93ac99b52a760acbc5b8acd45730588ec5531cbb (diff)
downloadjgit-414bfe05ff3c9fbca5767116348a4de1d7b95841.tar.gz
jgit-414bfe05ff3c9fbca5767116348a4de1d7b95841.zip
CommitGraph: teach ObjectReader to get commit-graph
FileRepository's ObjectReader#getCommitGraph will return commit-graph when it exists and core.commitGraph is true. DfsRepository is not supported currently. Change-Id: I992d43d104cf542797e6949470e95e56de025107 Signed-off-by: kylezhao <kylezhao@tencent.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java
index b4ebdcdf8e..ddc4a9d0ba 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java
@@ -237,6 +237,26 @@ public class ObjectDirectoryTest extends RepositoryTestCase {
}
@Test
+ public void testWindowCursorGetCommitGraph() throws Exception {
+ db.getConfig().setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
+ ConfigConstants.CONFIG_COMMIT_GRAPH, true);
+ db.getConfig().setBoolean(ConfigConstants.CONFIG_GC_SECTION, null,
+ ConfigConstants.CONFIG_KEY_WRITE_COMMIT_GRAPH, true);
+
+ WindowCursor curs = new WindowCursor(db.getObjectDatabase());
+ assertTrue(curs.getCommitGraph().isEmpty());
+ commitFile("file.txt", "content", "master");
+ GC gc = new GC(db);
+ gc.gc();
+ assertTrue(curs.getCommitGraph().isPresent());
+
+ db.getConfig().setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
+ ConfigConstants.CONFIG_COMMIT_GRAPH, false);
+
+ assertTrue(curs.getCommitGraph().isEmpty());
+ }
+
+ @Test
public void testShallowFileCorrupt() throws Exception {
FileRepository repository = createBareRepository();
ObjectDirectory dir = repository.getObjectDatabase();