commit-graph: add core.commitGraph setting

The commit graph feature is controlled by the new core.commitGraph config setting. This defaults to 0, so the feature is opt-in. The intention of core.commitGraph is that a user can always stop checking for or parsing commit graph files if core.commitGraph=0. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Apr 10, 2018 at 08:56 UTC 1b70dfd5946f76e40516f2229afbf249f185bc7a
4 files changed +11
Documentation/config.txt
+4
@@ -898,6 +898,10 @@ core.notesRef::
898 This setting defaults to "refs/notes/commits", and it can be overridden by
899 the `GIT_NOTES_REF` environment variable. See linkgit:git-notes[1].
900
901 +core.commitGraph::
902 + Enable git commit graph feature. Allows reading from the
903 + commit-graph file.
904 +
905 core.sparseCheckout::
906 Enable "sparse checkout" feature. See section "Sparse checkout" in
907 linkgit:git-read-tree[1] for more information.
cache.h
+1
@@ -801,6 +801,7 @@ extern char *git_replace_ref_base;
801
802 extern int fsync_object_files;
803 extern int core_preload_index;
804 +extern int core_commit_graph;
805 extern int core_apply_sparse_checkout;
806 extern int precomposed_unicode;
807 extern int protect_hfs;
config.c
+5
@@ -1226,6 +1226,11 @@ static int git_default_core_config(const char *var, const char *value)
1226 return 0;
1227 }
1228
1229 + if (!strcmp(var, "core.commitgraph")) {
1230 + core_commit_graph = git_config_bool(var, value);
1231 + return 0;
1232 + }
1233 +
1234 if (!strcmp(var, "core.sparsecheckout")) {
1235 core_apply_sparse_checkout = git_config_bool(var, value);
1236 return 0;
environment.c
+1
@@ -62,6 +62,7 @@ enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
62 enum object_creation_mode object_creation_mode = OBJECT_CREATION_MODE;
63 char *notes_ref_name;
64 int grafts_replace_parents = 1;
65 +int core_commit_graph;
66 int core_apply_sparse_checkout;
67 int merge_log_config = -1;
68 int precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */