Skip to content

Commit 2fa05f3

Browse files
ttaylorrgitster
authored andcommitted
t/helper/test-read-graph.c: support commit-graph chains
In 61df89c (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 61df89c, 'read_commit_graph_one' does not ever 'die()', making it a suitable replacement here. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a7df60c commit 2fa05f3

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

t/helper/test-read-graph.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,15 @@
77
int cmd__read_graph(int argc, const char **argv)
88
{
99
struct commit_graph *graph = NULL;
10-
char *graph_name;
11-
int open_ok;
12-
int fd;
13-
struct stat st;
1410
struct object_directory *odb;
1511

1612
setup_git_directory();
1713
odb = the_repository->objects->odb;
1814

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);
2616
if (!graph)
2717
return 1;
2818

29-
FREE_AND_NULL(graph_name);
3019

3120
printf("header: %08x %d %d %d %d\n",
3221
ntohl(*(uint32_t*)graph->data),

0 commit comments

Comments
 (0)