commit-graph: turn on commit-graph by default
[git/git.git] / repo-settings.c
CommitLineData
7211b9e7
DS
1#include "cache.h"
2#include "config.h"
3#include "repository.h"
4
31b1de6a
DS
5#define UPDATE_DEFAULT_BOOL(s,v) do { if (s == -1) { s = v; } } while(0)
6
7211b9e7
DS
7void prepare_repo_settings(struct repository *r)
8{
9 int value;
10
11 if (r->settings.initialized)
12 return;
13
14 /* Defaults */
15 memset(&r->settings, -1, sizeof(r->settings));
16
17 if (!repo_config_get_bool(r, "core.commitgraph", &value))
18 r->settings.core_commit_graph = value;
19 if (!repo_config_get_bool(r, "gc.writecommitgraph", &value))
20 r->settings.gc_write_commit_graph = value;
31b1de6a
DS
21 UPDATE_DEFAULT_BOOL(r->settings.core_commit_graph, 1);
22 UPDATE_DEFAULT_BOOL(r->settings.gc_write_commit_graph, 1);
7211b9e7
DS
23
24 if (!repo_config_get_bool(r, "index.version", &value))
25 r->settings.index_version = value;
26
27 if (!repo_config_get_bool(r, "pack.usesparse", &value))
28 r->settings.pack_use_sparse = value;
29}