CommitGraph: add core.commitGraph config
Change-Id: I3b5e735ebafba09ca18fd83da479c7950fa3ea8d Signed-off-by: kylezhao <kylezhao@tencent.com>
This commit is contained in:
parent
6ea36794d1
commit
7016e2ddae
|
@ -1581,6 +1581,20 @@ public void testCommitTemplateWithInvalidPath()
|
||||||
config.get(CommitConfig.KEY).getCommitTemplateContent(repo);
|
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)
|
private static void assertValueRoundTrip(String value)
|
||||||
throws ConfigInvalidException {
|
throws ConfigInvalidException {
|
||||||
assertValueRoundTrip(value, value);
|
assertValueRoundTrip(value, value);
|
||||||
|
|
|
@ -892,4 +892,11 @@ public final class ConfigConstants {
|
||||||
* @since 6.5
|
* @since 6.5
|
||||||
*/
|
*/
|
||||||
public static final String CONFIG_KEY_WRITE_COMMIT_GRAPH = "writeCommitGraph";
|
public static final String CONFIG_KEY_WRITE_COMMIT_GRAPH = "writeCommitGraph";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The "commitGraph" used by commit-graph feature
|
||||||
|
*
|
||||||
|
* @since 6.5
|
||||||
|
*/
|
||||||
|
public static final String CONFIG_COMMIT_GRAPH = "commitGraph";
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,13 @@ public enum LogRefUpdates {
|
||||||
ALWAYS
|
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 compression;
|
||||||
|
|
||||||
private final int packIndexVersion;
|
private final int packIndexVersion;
|
||||||
|
@ -126,6 +133,8 @@ public enum LogRefUpdates {
|
||||||
|
|
||||||
private final String attributesfile;
|
private final String attributesfile;
|
||||||
|
|
||||||
|
private final boolean commitGraph;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Options for symlink handling
|
* Options for symlink handling
|
||||||
*
|
*
|
||||||
|
@ -167,6 +176,9 @@ private CoreConfig(Config rc) {
|
||||||
ConfigConstants.CONFIG_KEY_EXCLUDESFILE);
|
ConfigConstants.CONFIG_KEY_EXCLUDESFILE);
|
||||||
attributesfile = rc.getString(ConfigConstants.CONFIG_CORE_SECTION,
|
attributesfile = rc.getString(ConfigConstants.CONFIG_CORE_SECTION,
|
||||||
null, ConfigConstants.CONFIG_KEY_ATTRIBUTESFILE);
|
null, ConfigConstants.CONFIG_KEY_ATTRIBUTESFILE);
|
||||||
|
commitGraph = rc.getBoolean(ConfigConstants.CONFIG_CORE_SECTION,
|
||||||
|
ConfigConstants.CONFIG_COMMIT_GRAPH,
|
||||||
|
DEFAULT_COMMIT_GRAPH_ENABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -219,4 +231,16 @@ public String getExcludesFile() {
|
||||||
public String getAttributesFile() {
|
public String getAttributesFile() {
|
||||||
return attributesfile;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue