[PATCH 1/9] Add and use generic name->id mapping code for color slot parsing

2018-05-10 Thread Nguyễn Thái Ngọc Duy
Instead of hard coding the name-to-id mapping in C code, keep it in an array and use a common function to do the parsing. This reduces code and also allows us to list all possible color slots later. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/branch.c | 28 + builtin/

Re: [PATCH 1/9] Add and use generic name->id mapping code for color slot parsing

2018-05-10 Thread Stefan Beller
On Thu, May 10, 2018 at 7:19 AM, Nguyễn Thái Ngọc Duy wrote: > 7 files changed, 82 insertions(+), 112 deletions(-) Nice! > > +static const char *color_branch_slots[] = { > + [BRANCH_COLOR_RESET]= "reset", In 512f41cfac5 (clean.c: use designated initializer, 2017-07-14) we thought w

Re: [PATCH 1/9] Add and use generic name->id mapping code for color slot parsing

2018-05-11 Thread Duy Nguyen
On Thu, May 10, 2018 at 7:16 PM, Stefan Beller wrote: > On Thu, May 10, 2018 at 7:19 AM, Nguyễn Thái Ngọc Duy > wrote: > >> 7 files changed, 82 insertions(+), 112 deletions(-) > > Nice! > > >> >> +static const char *color_branch_slots[] = { >> + [BRANCH_COLOR_RESET]= "reset", > > In 5