Re: [PATCHv4] diff.c: emit moved lines with a different color

2016-09-07 Thread Junio C Hamano
Ramsay Jones writes: >> +static int diff_line_moved_entry_cmp(const struct diff_line_moved_entry *a, >> + const struct diff_line_moved_entry *b, >> + const void *unused) >> +{ >> +return

Re: [PATCHv4] diff.c: emit moved lines with a different color

2016-09-06 Thread Jakub Narębski
W dniu 06.09.2016 o 19:03, Stefan Beller pisze: > On Tue, Sep 6, 2016 at 7:05 AM, Jakub Narębski wrote: >> If not for `color.moved`, I would have thought that instead of adding >> new command line option `--color-moved` (and the fact that it is on >> by default), we could

Re: [PATCHv4] diff.c: emit moved lines with a different color

2016-09-06 Thread Stefan Beller
On Tue, Sep 6, 2016 at 7:05 AM, Jakub Narębski wrote: > W dniu 06.09.2016 o 09:01, Stefan Beller pisze: > >> --- >> >> * moved new data structures into struct diff_options >> * color.moved=bool as well as --[no-]color-moved to {dis,en}able the new >> feature >> *

Re: [PATCHv4] diff.c: emit moved lines with a different color

2016-09-06 Thread Jakub Narębski
W dniu 06.09.2016 o 09:01, Stefan Beller pisze: > --- > > * moved new data structures into struct diff_options > * color.moved=bool as well as --[no-]color-moved to {dis,en}able the new > feature > * color.diff.movedfrom and color.diff.movedto to control the colors > * added a test [...] >

Re: [PATCHv4] diff.c: emit moved lines with a different color

2016-09-06 Thread Ramsay Jones
On 06/09/16 08:01, Stefan Beller wrote: [snip] > This patch was motivated by e.g. reviewing 3b0c4200 ("apply: move > libified code from builtin/apply.c to apply.{c,h}", 2016-08-08) > > Signed-off-by: Stefan Beller > --- > > * moved new data structures into struct

[PATCHv4] diff.c: emit moved lines with a different color

2016-09-06 Thread Stefan Beller
When we color the diff, we'll mark moved lines with a different color. This is achieved by doing a two passes over the diff. The first pass will inspect each line of the diff and store the removed lines and the added lines in its own hash map. The second pass will check for each added line if