t/helper/test-read-graph.c: support commit-graph chains
In 61df89c8e5 (commit-graph: don't early exit(1) on e.g. "git status", 2019-03-25), the former 'load_commit_graph_one' was refactored into 'open_commit_graph' and 'load_commit_graph_one_fd_st' as a means of avoiding an early-exit from non-library code. However, 'load_commit_graph_one' does not support commit-graph chains, and hence the 'read-graph' test tool does not work with them. Replace 'load_commit_graph_one' with 'read_commit_graph_one' in order to support commit-graph chains. In the spirit of 61df89c8e5, 'read_commit_graph_one' does not ever 'die()', making it a suitable replacement here. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Taylor Blau committed
Apr 13, 2020 at 22:04 UTC
2fa05f31bd95eed34d6e8848b6b1e6265674f50a
1 file changed
+1
-12
t/helper/test-read-graph.c
+1
-12
@@ -7,26 +7,15 @@
7
int cmd__read_graph(int argc, const char **argv)
8
{
9
struct commit_graph *graph = NULL;
10
- char *graph_name;
11
- int open_ok;
12
- int fd;
13
- struct stat st;
10
struct object_directory *odb;
11
12
setup_git_directory();
13
odb = the_repository->objects->odb;
14
19
- graph_name = get_commit_graph_filename(odb);
20
-
21
- open_ok = open_commit_graph(graph_name, &fd, &st);
22
- if (!open_ok)
23
- die_errno(_("Could not open commit-graph '%s'"), graph_name);
24
-
25
- graph = load_commit_graph_one_fd_st(fd, &st, odb);
15
+ graph = read_commit_graph_one(the_repository, odb);
16
if (!graph)
17
return 1;
18
29
- FREE_AND_NULL(graph_name);
19
20
printf("header: %08x %d %d %d %d\n",
21
ntohl(*(uint32_t*)graph->data),