Skip to content

Commit eed447d

Browse files
committed
Merge branch 'ps/commit-graph-wo-globals'
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
2 parents 4f58f6d + 7be9e41 commit eed447d

File tree

7 files changed

+157
-168
lines changed

7 files changed

+157
-168
lines changed

builtin/commit-graph.c

Lines changed: 5 additions & 4 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) {

builtin/commit.c

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

1950-
git_test_write_commit_graph_or_die();
1950+
git_test_write_commit_graph_or_die(the_repository->objects->sources);
19511951

19521952
repo_rerere(the_repository, 0);
19531953
run_auto_maintenance(quiet);

builtin/merge.c

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

1866-
git_test_write_commit_graph_or_die();
1866+
git_test_write_commit_graph_or_die(the_repository->objects->sources);
18671867
} else
18681868
write_merge_state(remoteheads);
18691869

0 commit comments

Comments
 (0)