1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
| | #include "cache.h"
#include "repository.h"
#include "config.h"
#include "repo-settings.h"
#define UPDATE_DEFAULT(s,v) if (s != -1) { s = v; }
static int git_repo_config(const char *key, const char *value, void *cb)
{
struct repo_settings *rs = (struct repo_settings *)cb;
if (!strcmp(key, "core.size")) {
if (!strcmp(value, "large")) {
UPDATE_DEFAULT(rs->core_commit_graph, 1);
UPDATE_DEFAULT(rs->gc_write_commit_graph, 1);
}
return 0;
}
if (!strcmp(key, "core.commitgraph")) {
rs->core_commit_graph = git_config_bool(key, value);
return 0;
}
if (!strcmp(key, "gc.writecommitgraph")) {
rs->gc_write_commit_graph = git_config_bool(key, value);
return 0;
}
return 1;
}
void prepare_repo_settings(struct repository *r)
{
if (r->settings)
return;
r->settings = xmalloc(sizeof(*r->settings));
/* Defaults */
r->settings->core_commit_graph = -1;
r->settings->gc_write_commit_graph = -1;
repo_config(r, git_repo_config, r->settings);
}
|