Re: [PATCH v3] log --graph: customize the graph lines with config log.graphColors

2017-01-09 Thread Junio C Hamano
Duy Nguyen writes: > On Mon, Jan 9, 2017 at 12:30 PM, Jeff King wrote: >> I also wonder if it is worth just using argv_array. We do not care about >> ... >> It is not much shorter than ALLOC_GROW(), but IMHO it is easier to read. > > Indeed. My only complaint is it's "argv_array_" and not > "str

Re: [PATCH v3] log --graph: customize the graph lines with config log.graphColors

2017-01-09 Thread Duy Nguyen
On Mon, Jan 9, 2017 at 12:30 PM, Jeff King wrote: > I also wonder if it is worth just using argv_array. We do not care about > NULL-terminating the list here, but it actually works pretty well as a > generic string-array class (and keeping a NULL at the end of any > array-of-pointers is a reasonab

Re: [PATCH v3] log --graph: customize the graph lines with config log.graphColors

2017-01-09 Thread Duy Nguyen
On Mon, Jan 9, 2017 at 12:34 PM, Jeff King wrote: >> +test_expect_success 'log --graph with merge with log.graphColors' ' >> + test_config log.graphColors " blue , cyan , red " && > > This funny syntax isn't required, right? It should work with the more > natural: > > test_config log.graph

Re: [PATCH v3] log --graph: customize the graph lines with config log.graphColors

2017-01-08 Thread Jeff King
On Sun, Jan 08, 2017 at 05:13:33PM +0700, Nguyễn Thái Ngọc Duy wrote: > If you have a 256 colors terminal (or one with true color support), then > the predefined 12 colors seem limited. On the other hand, you don't want > to draw graph lines with every single color in this mode because the two > c

Re: [PATCH v3] log --graph: customize the graph lines with config log.graphColors

2017-01-08 Thread Jeff King
On Sun, Jan 08, 2017 at 07:05:12PM -0800, Junio C Hamano wrote: > > +{ > > + static char **colors; > > + static int colors_max, colors_alloc; > > + char *string = NULL; > > + const char *end, *start; > > + int i; > > + > > + for (i = 0; i < colors_max; i++) > > + free(colors[

Re: [PATCH v3] log --graph: customize the graph lines with config log.graphColors

2017-01-08 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy writes: > diff --git a/graph.c b/graph.c > index dd17201..048f5cb 100644 > --- a/graph.c > +++ b/graph.c > @@ -62,6 +62,49 @@ enum graph_state { > static const char **column_colors; > static unsigned short column_colors_max; > > +static void set_column_colors(void) When

[PATCH v3] log --graph: customize the graph lines with config log.graphColors

2017-01-08 Thread Nguyễn Thái Ngọc Duy
If you have a 256 colors terminal (or one with true color support), then the predefined 12 colors seem limited. On the other hand, you don't want to draw graph lines with every single color in this mode because the two colors could look extremely similar. This option allows you to hand pick the col