Skip to content

Commit c475c50

Browse files
committed
Merge branch 'ps/commit-graph-wo-globals' into jch
Remove dependency on the_repository and other globals from the commit-graph code, and other changes unrelated to de-globaling. * ps/commit-graph-wo-globals: commit-graph: stop passing in redundant repository commit-graph: stop using `the_repository` commit-graph: stop using `the_hash_algo` commit-graph: refactor `parse_commit_graph()` to take a repository commit-graph: store the hash algorithm instead of its length commit-graph: stop using `the_hash_algo` via macros commit-graph: fix sign comparison warnings commit-graph: fix type for some write options commit-graph: stop using signed integers to count Bloom filters trace2: introduce function to trace unsigned integers
2 parents 61118da + f3f1b3b commit c475c50

File tree

9 files changed

+227
-217
lines changed

9 files changed

+227
-217
lines changed

builtin/commit-graph.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ static int graph_verify(int argc, const char **argv, const char *prefix,
109109
opened = OPENED_GRAPH;
110110
else if (errno != ENOENT)
111111
die_errno(_("Could not open commit-graph '%s'"), graph_name);
112-
else if (open_commit_graph_chain(chain_name, &fd, &st))
112+
else if (open_commit_graph_chain(chain_name, &fd, &st,
113+
the_repository->hash_algo))
113114
opened = OPENED_CHAIN;
114115
else if (errno != ENOENT)
115116
die_errno(_("could not open commit-graph chain '%s'"), chain_name);
@@ -121,15 +122,15 @@ static int graph_verify(int argc, const char **argv, const char *prefix,
121122
if (opened == OPENED_NONE)
122123
return 0;
123124
else if (opened == OPENED_GRAPH)
124-
graph = load_commit_graph_one_fd_st(the_repository, fd, &st, source);
125+
graph = load_commit_graph_one_fd_st(source, fd, &st);
125126
else
126-
graph = load_commit_graph_chain_fd_st(the_repository, fd, &st,
127+
graph = load_commit_graph_chain_fd_st(the_repository->objects, fd, &st,
127128
&incomplete_chain);
128129

129130
if (!graph)
130131
return 1;
131132

132-
ret = verify_commit_graph(the_repository, graph, flags);
133+
ret = verify_commit_graph(graph, flags);
133134
free_commit_graph(graph);
134135

135136
if (incomplete_chain) {
@@ -242,9 +243,9 @@ static int graph_write(int argc, const char **argv, const char *prefix,
242243
N_("allow writing an incremental commit-graph file"),
243244
PARSE_OPT_OPTARG | PARSE_OPT_NONEG,
244245
write_option_parse_split),
245-
OPT_INTEGER(0, "max-commits", &write_opts.max_commits,
246+
OPT_UNSIGNED(0, "max-commits", &write_opts.max_commits,
246247
N_("maximum number of commits in a non-base split commit-graph")),
247-
OPT_INTEGER(0, "size-multiple", &write_opts.size_multiple,
248+
OPT_UNSIGNED(0, "size-multiple", &write_opts.size_multiple,
248249
N_("maximum ratio between two levels of a split commit-graph")),
249250
OPT_EXPIRY_DATE(0, "expire-time", &write_opts.expire_time,
250251
N_("only expire files older than a given date-time")),

builtin/commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1954,7 +1954,7 @@ int cmd_commit(int argc,
19541954
"new index file. Check that disk is not full and quota is\n"
19551955
"not exceeded, and then \"git restore --staged :/\" to recover."));
19561956

1957-
git_test_write_commit_graph_or_die();
1957+
git_test_write_commit_graph_or_die(the_repository->objects->sources);
19581958

19591959
repo_rerere(the_repository, 0);
19601960
run_auto_maintenance(quiet);

builtin/merge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,7 @@ int cmd_merge(int argc,
18651865
if (squash) {
18661866
finish(head_commit, remoteheads, NULL, NULL);
18671867

1868-
git_test_write_commit_graph_or_die();
1868+
git_test_write_commit_graph_or_die(the_repository->objects->sources);
18691869
} else
18701870
write_merge_state(remoteheads);
18711871

0 commit comments

Comments
 (0)