From: Pablo Sabater Date: Tue, 14 Jul 2026 12:09:37 +0000 (+0200) Subject: graph: move config reading into graph_read_config() X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=f3a03302ada79d69cf97e601a0cd766330430ef7;p=thirdparty%2Fgit.git graph: move config reading into graph_read_config() Move the repo_config_get_string() call out of graph_init() and into graph_read_config(). This simplifies graph_init() and provides a function for future graph-related config opt. This commit is a preparatory commit for a subsequent one. Signed-off-by: Pablo Sabater Signed-off-by: Junio C Hamano --- diff --git a/graph.c b/graph.c index e3e206170c..c14be934a0 100644 --- a/graph.c +++ b/graph.c @@ -417,13 +417,11 @@ void graph_setup_line_prefix(struct diff_options *diffopt) diffopt->output_prefix = diff_output_prefix_callback; } -struct git_graph *graph_init(struct rev_info *opt) +static void graph_read_config(struct rev_info *revs) { - struct git_graph *graph = xmalloc(sizeof(struct git_graph)); - if (!column_colors) { char *string; - if (repo_config_get_string(opt->repo, "log.graphcolors", &string)) { + if (repo_config_get_string(revs->repo, "log.graphcolors", &string)) { /* not configured -- use default */ graph_set_column_colors(column_colors_ansi, column_colors_ansi_max); @@ -437,6 +435,13 @@ struct git_graph *graph_init(struct rev_info *opt) custom_colors.nr - 1); } } +} + +struct git_graph *graph_init(struct rev_info *opt) +{ + struct git_graph *graph = xmalloc(sizeof(struct git_graph)); + + graph_read_config(opt); graph->commit = NULL; graph->revs = opt;