From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail•com>, git@vger•kernel.org
Subject: Re: [PATCH v5 3/3] log --graph: customize the graph lines with config log.graphColors
Date: Thu, 19 Jan 2017 11:34:38 -0800 [thread overview]
Message-ID: <xmqqd1fi269d.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <xmqq1svy3nxi.fsf@gitster.mtv.corp.google.com> (Junio C. Hamano's message of "Thu, 19 Jan 2017 10:27:37 -0800")
Junio C Hamano <gitster@pobox•com> writes:
>> Since there's only one line that cares about the result of "colors",
>> maybe it would be less confusing to do:
>>
>> if (!git_config_get-string("log.graphcolors", &string)) {
>> ... parse, etc ...
>> graph_set_column_colors(colors.argv, colors.argc - 1);
>> } else {
>> graph_set_column_colors(column_colors_ansi,
>> column_colors_ansi_max);
>> }
>
> Yes, that would be much much less confusing. By doing so, the cover
> letter can lose "pushing the limits of abuse", too ;-).
Will queue with a squashable change.
Thanks.
graph.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/graph.c b/graph.c
index 822d40ae20..00aeee36d8 100644
--- a/graph.c
+++ b/graph.c
@@ -229,22 +229,20 @@ struct git_graph *graph_init(struct rev_info *opt)
struct git_graph *graph = xmalloc(sizeof(struct git_graph));
if (!column_colors) {
- struct argv_array ansi_colors = {
- column_colors_ansi,
- column_colors_ansi_max + 1
- };
- struct argv_array *colors = &ansi_colors;
char *string;
-
- if (!git_config_get_string("log.graphcolors", &string)) {
+ if (git_config_get_string("log.graphcolors", &string)) {
+ /* not configured -- use default */
+ graph_set_column_colors(column_colors_ansi,
+ column_colors_ansi_max);
+ } else {
static struct argv_array custom_colors = ARGV_ARRAY_INIT;
argv_array_clear(&custom_colors);
parse_graph_colors_config(&custom_colors, string);
free(string);
- colors = &custom_colors;
+ /* graph_set_column_colors takes a max-index, not a count */
+ graph_set_column_colors(custom_colors.argv,
+ custom_colors.argc - 1);
}
- /* graph_set_column_colors takes a max-index, not a count */
- graph_set_column_colors(colors->argv, colors->argc - 1);
}
graph->commit = NULL;
prev parent reply other threads:[~2017-01-19 19:36 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-20 12:39 [PATCH] log: support 256 colors with --graph=256colors Nguyễn Thái Ngọc Duy
2016-12-20 16:57 ` Jeff King
2016-12-22 9:48 ` Duy Nguyen
2016-12-22 19:06 ` Junio C Hamano
2016-12-25 2:36 ` Duy Nguyen
2016-12-20 17:26 ` Junio C Hamano
2016-12-22 9:38 ` Duy Nguyen
2016-12-24 11:38 ` [PATCH v2] log --graph: customize the graph lines with config log.graphColors Nguyễn Thái Ngọc Duy
2016-12-25 23:02 ` Junio C Hamano
2017-01-08 10:13 ` [PATCH v3] " Nguyễn Thái Ngọc Duy
2017-01-09 3:05 ` Junio C Hamano
2017-01-09 5:30 ` Jeff King
2017-01-09 10:30 ` Duy Nguyen
2017-01-09 14:23 ` Junio C Hamano
2017-01-09 5:34 ` Jeff King
2017-01-09 10:10 ` Duy Nguyen
2017-01-09 10:32 ` [PATCH v4] " Nguyễn Thái Ngọc Duy
2017-01-09 17:29 ` Junio C Hamano
2017-01-12 12:20 ` Duy Nguyen
2017-01-19 11:41 ` [PATCH v5 0/3] nd/log-graph-configurable-colors Nguyễn Thái Ngọc Duy
2017-01-19 11:41 ` [PATCH v5 1/3] color.c: fix color_parse_mem() with value_len == 0 Nguyễn Thái Ngọc Duy
2017-01-19 16:38 ` Jeff King
2017-01-28 4:07 ` Jeff King
2017-01-19 11:41 ` [PATCH v5 2/3] color.c: trim leading spaces in color_parse_mem() Nguyễn Thái Ngọc Duy
2017-01-19 16:41 ` Jeff King
2017-01-19 18:22 ` Junio C Hamano
2017-01-19 11:41 ` [PATCH v5 3/3] log --graph: customize the graph lines with config log.graphColors Nguyễn Thái Ngọc Duy
2017-01-19 16:51 ` Jeff King
2017-01-19 18:27 ` Junio C Hamano
2017-01-19 19:34 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqd1fi269d.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=pclouds@gmail$(echo .)com \
--cc=peff@peff$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox