config.get(CommitConfig.KEY).getCommitTemplateContent(repo);
}
+ @Test
+ public void testCoreCommitGraphConfig() {
+ Config config = new Config();
+ assertFalse(config.get(CoreConfig.KEY).enableCommitGraph());
+
+ config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
+ ConfigConstants.CONFIG_COMMIT_GRAPH, true);
+ assertTrue(config.get(CoreConfig.KEY).enableCommitGraph());
+
+ config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
+ ConfigConstants.CONFIG_COMMIT_GRAPH, false);
+ assertFalse(config.get(CoreConfig.KEY).enableCommitGraph());
+ }
+
private static void assertValueRoundTrip(String value)
throws ConfigInvalidException {
assertValueRoundTrip(value, value);
ALWAYS
}
+ /**
+ * Default value of commit graph enable option: {@value}
+ *
+ * @since 6.5
+ */
+ public static final boolean DEFAULT_COMMIT_GRAPH_ENABLE = false;
+
private final int compression;
private final int packIndexVersion;
private final String attributesfile;
+ private final boolean commitGraph;
+
/**
* Options for symlink handling
*
ConfigConstants.CONFIG_KEY_EXCLUDESFILE);
attributesfile = rc.getString(ConfigConstants.CONFIG_CORE_SECTION,
null, ConfigConstants.CONFIG_KEY_ATTRIBUTESFILE);
+ commitGraph = rc.getBoolean(ConfigConstants.CONFIG_CORE_SECTION,
+ ConfigConstants.CONFIG_COMMIT_GRAPH,
+ DEFAULT_COMMIT_GRAPH_ENABLE);
}
/**
public String getAttributesFile() {
return attributesfile;
}
+
+ /**
+ * Whether to read the commit-graph file (if it exists) to parse the graph
+ * structure of commits. Default to
+ * {@value org.eclipse.jgit.lib.CoreConfig#DEFAULT_COMMIT_GRAPH_ENABLE}.
+ *
+ * @return whether to read the commit-graph file
+ * @since 6.5
+ */
+ public boolean enableCommitGraph() {
+ return commitGraph;
+ }
}