Hi Stefan,

On Fri, 10 Aug 2018, Stefan Beller wrote:

> This change itself only changes the internal communication and should
> have no visible effect to the user. We instruct the diff code that produces
> the inner diffs to use X, Y, Z instead of the usual markers for new, old
> and context lines
> 
> Signed-off-by: Stefan Beller <sbel...@google.com>
> ---
>  range-diff.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/range-diff.c b/range-diff.c
> index b6b9abac266..6e4192c8e79 100644
> --- a/range-diff.c
> +++ b/range-diff.c
> @@ -38,6 +38,9 @@ static int read_patches(const char *range, struct 
> string_list *list)
>  
>       argv_array_pushl(&cp.args, "log", "--no-color", "-p", "--no-merges",
>                       "--reverse", "--date-order", "--decorate=no",
> +                     "--output-indicator-new=X",
> +                     "--output-indicator-old=Y",
> +                     "--output-indicator-context=Z",
>                       "--no-abbrev-commit", range,
>                       NULL);
>       cp.out = -1;
> @@ -108,8 +111,18 @@ static int read_patches(const char *range, struct 
> string_list *list)
>                        * we are not interested.
>                        */
>                       continue;
> -             else
> +             else if (line.buf[0] == 'X') {
> +                     strbuf_addch(&buf, '+');
> +                     strbuf_add(&buf, line.buf + 1, line.len - 1);
> +             } else if (line.buf[0] == 'Y') {
> +                     strbuf_addch(&buf, '-');
> +                     strbuf_add(&buf, line.buf + 1, line.len - 1);
> +             } else if (line.buf[0] == 'Z') {
> +                     strbuf_addch(&buf, ' ');
> +                     strbuf_add(&buf, line.buf + 1, line.len - 1);
> +             } else {
>                       strbuf_addbuf(&buf, &line);
> +             }

My preliminary reading (I sadly lack the time to pull your branch and play
with it) suggests that this works, although I have to admit that X/Y/Z
would confuse me in 6 months from now, as they do not really read like
diff markers but like plain text. I could imagine that '>', '<' and '#'
would not impart that confusion on me.

Ciao,
Dscho

>  
>               strbuf_addch(&buf, '\n');
>               util->diffsize++;
> -- 
> 2.18.0.865.gffc8e1a3cd6-goog
> 
> 

Reply via email to